p2p/discover: explain

This commit is contained in:
Felix Lange 2024-05-22 12:30:59 +02:00
parent 6e37d520e9
commit 9ec2553844

View file

@ -79,7 +79,7 @@ type Table struct {
refreshReq chan chan struct{} refreshReq chan chan struct{}
revalResponseCh chan revalidationResponse revalResponseCh chan revalidationResponse
addNodeCh chan addNodeOp addNodeCh chan addNodeOp
addNodeHandled chan bool addNodeHandled chan 1bool
trackRequestCh chan trackRequestOp trackRequestCh chan trackRequestOp
initDone chan struct{} initDone chan struct{}
closeReq chan struct{} closeReq chan struct{}
@ -638,8 +638,10 @@ func (tab *Table) handleTrackRequest(op trackRequestOp) {
b := tab.bucket(op.node.ID()) b := tab.bucket(op.node.ID())
// Remove the node from the local table if it fails to return anything useful too // Remove the node from the local table if it fails to return anything useful too
// many times, but only if there are enough other nodes in the bucket. // many times, but only if there are enough other nodes in the bucket. This latter
if fails >= maxFindnodeFailures && len(b.entries) >= bucketSize/2 { // condition specifically exists to make bootstrapping in smaller test networks more
// reliable.
if fails >= maxFindnodeFailures && len(b.entries) >= bucketSize/4 {
tab.deleteInBucket(b, op.node.ID()) tab.deleteInBucket(b, op.node.ID())
} }