p2p/discover: don't attempt to replace nodes that are being replaced
PR #1621 changed Table locking so the mutex is not held while a contested node is being pinged. If multiple nodes ping the local node during this time window, multiple ping packets will be sent to the contested node. The changes in this commit prevent multiple packets by tracking whether the node is being replaced.
This commit is contained in:
@ -48,6 +48,10 @@ type Node struct {
|
||||
// In those tests, the content of sha will not actually correspond
|
||||
// with ID.
|
||||
sha common.Hash
|
||||
|
||||
// whether this node is currently being pinged in order to replace
|
||||
// it in a bucket
|
||||
contested bool
|
||||
}
|
||||
|
||||
func newNode(id NodeID, ip net.IP, udpPort, tcpPort uint16) *Node {
|
||||
|
Reference in New Issue
Block a user