Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
2573094d
Unverified
Commit
2573094d
authored
Dec 14, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/discover, p2p/discv5: use flexible comparison for IPs
parent
745026b7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
5 deletions
+4
-5
udp_test.go
p2p/discover/udp_test.go
+1
-1
net.go
p2p/discv5/net.go
+1
-1
node.go
p2p/discv5/node.go
+1
-2
udp.go
p2p/discv5/udp.go
+1
-1
No files found.
p2p/discover/udp_test.go
View file @
2573094d
...
@@ -374,7 +374,7 @@ func TestUDP_successfulPing(t *testing.T) {
...
@@ -374,7 +374,7 @@ func TestUDP_successfulPing(t *testing.T) {
if
n
.
ID
!=
rid
{
if
n
.
ID
!=
rid
{
t
.
Errorf
(
"node has wrong ID: got %v, want %v"
,
n
.
ID
,
rid
)
t
.
Errorf
(
"node has wrong ID: got %v, want %v"
,
n
.
ID
,
rid
)
}
}
if
!
bytes
.
Equal
(
n
.
IP
,
test
.
remoteaddr
.
IP
)
{
if
!
n
.
IP
.
Equal
(
test
.
remoteaddr
.
IP
)
{
t
.
Errorf
(
"node has wrong IP: got %v, want: %v"
,
n
.
IP
,
test
.
remoteaddr
.
IP
)
t
.
Errorf
(
"node has wrong IP: got %v, want: %v"
,
n
.
IP
,
test
.
remoteaddr
.
IP
)
}
}
if
int
(
n
.
UDP
)
!=
test
.
remoteaddr
.
Port
{
if
int
(
n
.
UDP
)
!=
test
.
remoteaddr
.
Port
{
...
...
p2p/discv5/net.go
View file @
2573094d
...
@@ -759,7 +759,7 @@ func (net *Network) internNodeFromNeighbours(sender *net.UDPAddr, rn rpcNode) (n
...
@@ -759,7 +759,7 @@ func (net *Network) internNodeFromNeighbours(sender *net.UDPAddr, rn rpcNode) (n
}
}
return
n
,
err
return
n
,
err
}
}
if
!
bytes
.
Equal
(
n
.
IP
,
rn
.
IP
)
||
n
.
UDP
!=
rn
.
UDP
||
n
.
TCP
!=
rn
.
TCP
{
if
!
n
.
IP
.
Equal
(
rn
.
IP
)
||
n
.
UDP
!=
rn
.
UDP
||
n
.
TCP
!=
rn
.
TCP
{
err
=
fmt
.
Errorf
(
"metadata mismatch: got %v, want %v"
,
rn
,
n
)
err
=
fmt
.
Errorf
(
"metadata mismatch: got %v, want %v"
,
rn
,
n
)
}
}
return
n
,
err
return
n
,
err
...
...
p2p/discv5/node.go
View file @
2573094d
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
package
discv5
package
discv5
import
(
import
(
"bytes"
"crypto/ecdsa"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/elliptic"
"encoding/hex"
"encoding/hex"
...
@@ -81,7 +80,7 @@ func (n *Node) addrEqual(a *net.UDPAddr) bool {
...
@@ -81,7 +80,7 @@ func (n *Node) addrEqual(a *net.UDPAddr) bool {
if
ipv4
:=
a
.
IP
.
To4
();
ipv4
!=
nil
{
if
ipv4
:=
a
.
IP
.
To4
();
ipv4
!=
nil
{
ip
=
ipv4
ip
=
ipv4
}
}
return
n
.
UDP
==
uint16
(
a
.
Port
)
&&
bytes
.
Equal
(
n
.
IP
,
ip
)
return
n
.
UDP
==
uint16
(
a
.
Port
)
&&
n
.
IP
.
Equal
(
ip
)
}
}
// Incomplete returns true for nodes with no IP address.
// Incomplete returns true for nodes with no IP address.
...
...
p2p/discv5/udp.go
View file @
2573094d
...
@@ -196,7 +196,7 @@ func makeEndpoint(addr *net.UDPAddr, tcpPort uint16) rpcEndpoint {
...
@@ -196,7 +196,7 @@ func makeEndpoint(addr *net.UDPAddr, tcpPort uint16) rpcEndpoint {
}
}
func
(
e1
rpcEndpoint
)
equal
(
e2
rpcEndpoint
)
bool
{
func
(
e1
rpcEndpoint
)
equal
(
e2
rpcEndpoint
)
bool
{
return
e1
.
UDP
==
e2
.
UDP
&&
e1
.
TCP
==
e2
.
TCP
&&
bytes
.
Equal
(
e1
.
IP
,
e2
.
IP
)
return
e1
.
UDP
==
e2
.
UDP
&&
e1
.
TCP
==
e2
.
TCP
&&
e1
.
IP
.
Equal
(
e2
.
IP
)
}
}
func
nodeFromRPC
(
sender
*
net
.
UDPAddr
,
rn
rpcNode
)
(
*
Node
,
error
)
{
func
nodeFromRPC
(
sender
*
net
.
UDPAddr
,
rn
rpcNode
)
(
*
Node
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment