Skip to content

Commit

Permalink
Merge pull request #198 from dashevo/lklimek/fix-seeds-orphaned
Browse files Browse the repository at this point in the history
fix: seeds should try to reconnect to another seed when they get disconnected from the whole network
  • Loading branch information
QuantumExplorer authored Oct 26, 2021
2 parents b766e89 + 7a8044c commit 1742e2a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions p2p/pex/pex_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,14 @@ func (r *Reactor) crawlPeersRoutine() {
select {
case <-ticker.C:
r.attemptDisconnects()

// If we got disconnected from the whole network, we reconnect to seeds
out, in, dial := r.Switch.NumPeers()
if out+in+dial < 1 {
r.Logger.Info("All peers disconnected, dialing seeds")
r.dialSeeds()
}

r.crawlPeers(r.book.GetSelection())
r.cleanupCrawlPeerInfos()
case <-r.Quit():
Expand Down

0 comments on commit 1742e2a

Please sign in to comment.