mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
swarm/network: must replace node if bucket is full otherwise nodes will get stuck on empty rows
This commit is contained in:
parent
1e9b3c1583
commit
2b1c950193
1 changed files with 5 additions and 1 deletions
|
|
@ -340,7 +340,11 @@ func (self *bucket) insert(node Node) (replaced Node, err error) {
|
|||
if len(self.nodes) >= self.size { // >= allows us to add peers beyond the bucketsize limitation
|
||||
// dev p2p kicks out nodes idle for > 30 s, so here we never replace nodes if
|
||||
// bucket is full
|
||||
return nil, fmt.Errorf("bucket full")
|
||||
// update, it seems we need to replace nodes
|
||||
// return nil, fmt.Errorf("bucket full")
|
||||
replaced := self.nodes[0]
|
||||
self.nodes = append(self.nodes[1:], node)
|
||||
return replaced, nil
|
||||
}
|
||||
self.nodes = append(self.nodes, node)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue