diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-17 17:27:41 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-19 20:57:16 +0800 |
commit | dd54fef89888372ab5961c1b5a6ac917fc47d49c (patch) | |
tree | 83cf697002fd089f3642e88732930b38ebaa5e7c /p2p/discover/node.go | |
parent | edccc7ae3430836141b803c252f26bf1ef98d185 (diff) | |
download | dexon-dd54fef89888372ab5961c1b5a6ac917fc47d49c.tar.gz dexon-dd54fef89888372ab5961c1b5a6ac917fc47d49c.tar.zst dexon-dd54fef89888372ab5961c1b5a6ac917fc47d49c.zip |
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.
Diffstat (limited to 'p2p/discover/node.go')
-rw-r--r-- | p2p/discover/node.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/p2p/discover/node.go b/p2p/discover/node.go index b6956e197..a14f29424 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -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 { |