From d228afc5483ef2f2143e9d0ce4b3e5dcba70f8bb Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Wed, 16 Jun 2021 17:06:00 -0400 Subject: [PATCH] p2p: avoid retry delay in error case (#6591) --- internal/p2p/peermanager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/p2p/peermanager.go b/internal/p2p/peermanager.go index ce731a440..c30a933ff 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -539,7 +539,7 @@ func (m *PeerManager) DialFailed(address NodeAddress) error { // timeout has elapsed, so that we can consider dialing it again. We // calculate the retry delay outside the goroutine, since it must hold // the mutex lock. - if d := m.retryDelay(addressInfo.DialFailures, peer.Persistent); d != retryNever { + if d := m.retryDelay(addressInfo.DialFailures, peer.Persistent); d != 0 && d != retryNever { go func() { // Use an explicit timer with deferred cleanup instead of // time.After(), to avoid leaking goroutines on PeerManager.Close().