mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
p2p: remove Equal function
This commit is contained in:
parent
100c6c9f47
commit
90993c2f78
2 changed files with 1 additions and 11 deletions
|
|
@ -253,13 +253,3 @@ func RandomID(a ID, n int) (b ID) {
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equal returns a boolean reporting whether a and b contain the same bytes.
|
|
||||||
func Equal(a, b ID) bool {
|
|
||||||
for i := range a {
|
|
||||||
if a[i] != b[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ func (c *meteredConn) handshakeDone(id enode.ID) {
|
||||||
func (c *meteredConn) Close() error {
|
func (c *meteredConn) Close() error {
|
||||||
err := c.Conn.Close()
|
err := c.Conn.Close()
|
||||||
c.lock.RLock()
|
c.lock.RLock()
|
||||||
if enode.Equal(c.id, enode.ID{}) {
|
if c.id == (enode.ID{}) {
|
||||||
// If the peer disconnects before the handshake.
|
// If the peer disconnects before the handshake.
|
||||||
c.lock.RUnlock()
|
c.lock.RUnlock()
|
||||||
meteredPeerFeed.Send(MeteredPeerEvent{
|
meteredPeerFeed.Send(MeteredPeerEvent{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue