diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 183b9d60b..98acd282c 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -19,6 +19,7 @@ Special thanks to external contributors on this release: ### FEATURES: ### IMPROVEMENTS: +- [pex] \#3037 only log "Reached max attempts to dial" once ### BUG FIXES: - [p2p] \#2967 Fix file descriptor leaks diff --git a/p2p/pex/pex_reactor.go b/p2p/pex/pex_reactor.go index 057aadaa2..0b043ca83 100644 --- a/p2p/pex/pex_reactor.go +++ b/p2p/pex/pex_reactor.go @@ -471,7 +471,11 @@ func (r *PEXReactor) dialPeer(addr *p2p.NetAddress) { attempts, lastDialed := r.dialAttemptsInfo(addr) if attempts > maxAttemptsToDial { - r.Logger.Error("Reached max attempts to dial", "addr", addr, "attempts", attempts) + // Do not log the message if the addr gets readded. + if attempts+1 == maxAttemptsToDial { + r.Logger.Info("Reached max attempts to dial", "addr", addr, "attempts", attempts) + r.attemptsToDial.Store(addr.DialString(), _attemptsToDial{attempts + 1, time.Now()}) + } r.book.MarkBad(addr) return }