only log "Reached max attempts to dial" once (#3144)

Closes #3037
This commit is contained in:
Anton Kaliaev
2019-01-24 13:53:02 +04:00
committed by GitHub
parent fbd1e79465
commit c4157549ab
2 changed files with 6 additions and 1 deletions

View File

@@ -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

View File

@@ -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
}