mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-02 13:25:45 +00:00
pex: dial seeds when address book needs more addresses (#3603)
If we are low on addresses for peering, we need to discover more peers. The previous behavior would query existing peers; however, if an existing peer does not participate in peer exchange, then our node will not discover more peers. This change consults both existing peers as well as seeds when there is a deficit in address book addresses. This allows for discovering peers though existing channels as well as via seeds if existing peers do not share addresses.
This commit is contained in:
committed by
Anton Kaliaev
parent
2585187880
commit
40dbad9915
@@ -27,3 +27,4 @@
|
||||
- [p2p] \#3532 limit the number of attempts to connect to a peer in seed mode
|
||||
to 16 (as a result, the node will stop retrying after a 35 hours time window)
|
||||
- [consensus] \#2723, \#3451 and \#3317 Fix non-deterministic tests
|
||||
- [pex] \#3603 Dial seeds when addrbook needs more addresses (@defunctzombie)
|
||||
@@ -493,9 +493,10 @@ func (r *PEXReactor) ensurePeers() {
|
||||
}
|
||||
}
|
||||
|
||||
// If we are not connected to nor dialing anybody, fallback to dialing a seed.
|
||||
if out+in+dial+len(toDial) == 0 {
|
||||
r.Logger.Info("No addresses to dial nor connected peers. Falling back to seeds")
|
||||
// If we are not dialing anyone and need more addresses - dial a seed
|
||||
// This is done in addition to asking a peer for addresses to work-around peers not participating in PEX
|
||||
if r.book.NeedMoreAddrs() && len(toDial) == 0 {
|
||||
r.Logger.Info("No addresses to dial. Falling back to seeds")
|
||||
r.dialSeeds()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user