Skip to content

Commit

Permalink
Merge pull request #31 from zenon-network/fix/p2p-no-seeders
Browse files Browse the repository at this point in the history
[p2p] Allow discovery refresh to handle empty peers
  • Loading branch information
georgezgeorgez authored Oct 10, 2023
2 parents 3613473 + 46e59d4 commit 83469e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions p2p/discover/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,11 @@ func (tab *Table) refresh(forceSeed bool) {

nodes := append(tab.nursery, seeds...)

for i := uint32(len(nodes)) - 1; i > 0; i-- {
j := randUint(i)
nodes[i], nodes[j] = nodes[j], nodes[i]
if len(nodes) > 0 {
for i := uint32(len(nodes)) - 1; i > 0; i-- {
j := randUint(i)
nodes[i], nodes[j] = nodes[j], nodes[i]
}
}

// Bond with all the seed nodes (will pingpong only if failed recently)
Expand Down

0 comments on commit 83469e4

Please sign in to comment.