mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
p2p: re-check after sleeps (#2664)
* p2p: re-check after sleeps * use NodeInfo as an interface * Revert "use NodeInfo as an interface" This reverts commit5f7d055e6c. * Revert "p2p: re-check after sleeps" This reverts commit7f41070da0. * preserve dial to itself * ignore ensured connections while re-connecting * re-check after sleep * keep protocol definition on net addresses * decrease log level * Revert "preserve dial to itself" This reverts commit0c6e0fc58d. * correct func comment according to modification Co-Authored-By: mgurevin <mehmet@gurevin.net>
This commit is contained in:
committed by
Ethan Buchman
parent
7a4b62d3be
commit
905abf1388
@@ -328,6 +328,11 @@ func (sw *Switch) reconnectToPeer(addr *NetAddress) {
|
||||
return
|
||||
}
|
||||
|
||||
if sw.IsDialingOrExistingAddress(addr) {
|
||||
sw.Logger.Debug("Peer connection has been established or dialed while we waiting next try", "addr", addr)
|
||||
return
|
||||
}
|
||||
|
||||
err := sw.DialPeerWithAddress(addr, true)
|
||||
if err == nil {
|
||||
return // success
|
||||
@@ -415,12 +420,15 @@ func (sw *Switch) DialPeersAsync(addrBook AddrBook, peers []string, persistent b
|
||||
if addr.Same(ourAddr) {
|
||||
sw.Logger.Debug("Ignore attempt to connect to ourselves", "addr", addr, "ourAddr", ourAddr)
|
||||
return
|
||||
} else if sw.IsDialingOrExistingAddress(addr) {
|
||||
}
|
||||
|
||||
sw.randomSleep(0)
|
||||
|
||||
if sw.IsDialingOrExistingAddress(addr) {
|
||||
sw.Logger.Debug("Ignore attempt to connect to an existing peer", "addr", addr)
|
||||
return
|
||||
}
|
||||
|
||||
sw.randomSleep(0)
|
||||
err := sw.DialPeerWithAddress(addr, persistent)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
|
||||
Reference in New Issue
Block a user