From 2f8ba806897c19377184c1879e532da01c5aa295 Mon Sep 17 00:00:00 2001 From: Hongmin Date: Sun, 27 Oct 2019 23:41:56 +0800 Subject: [PATCH] p2p: log as debug msg when address dialing is already connected (#4082) Fixes #3991 --- CHANGELOG_PENDING.md | 1 + p2p/pex/pex_reactor.go | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index a1a121164..689b2ed9b 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -22,6 +22,7 @@ program](https://hackerone.com/tendermint). - [mempool] [\#4057](https://github.com/tendermint/tendermint/issues/4057) Include peer ID when logging rejected txns (@erikgrinaker) - [tools] [\#4023](https://github.com/tendermint/tendermint/issues/4023) Improved `tm-monitor` formatting of start time and avg tx throughput (@erikgrinaker) +- [p2p] [\#3991](https://github.com/tendermint/tendermint/issues/3991) Log "has been established or dialed" as debug log instead of Error for connected peers (@whunmr) ### BUG FIXES: diff --git a/p2p/pex/pex_reactor.go b/p2p/pex/pex_reactor.go index 53ca11fe6..46d09d0cb 100644 --- a/p2p/pex/pex_reactor.go +++ b/p2p/pex/pex_reactor.go @@ -368,7 +368,7 @@ func (r *PEXReactor) ReceiveAddrs(addrs []*p2p.NetAddress, src Peer) error { err := r.dialPeer(addr) if err != nil { switch err.(type) { - case errMaxAttemptsToDial, errTooEarlyToDial: + case errMaxAttemptsToDial, errTooEarlyToDial, p2p.ErrCurrentlyDialingOrExistingAddress: r.Logger.Debug(err.Error(), "addr", addr) default: r.Logger.Error(err.Error(), "addr", addr) @@ -590,7 +590,9 @@ func (r *PEXReactor) dialSeeds() { // dial a random seed seedAddr := r.seedAddrs[i] err := r.Switch.DialPeerWithAddress(seedAddr) - if err == nil { + + switch err.(type) { + case nil, p2p.ErrCurrentlyDialingOrExistingAddress: return } r.Switch.Logger.Error("Error dialing seed", "err", err, "seed", seedAddr) @@ -676,7 +678,7 @@ func (r *PEXReactor) crawlPeers(addrs []*p2p.NetAddress) { err := r.dialPeer(addr) if err != nil { switch err.(type) { - case errMaxAttemptsToDial, errTooEarlyToDial: + case errMaxAttemptsToDial, errTooEarlyToDial, p2p.ErrCurrentlyDialingOrExistingAddress: r.Logger.Debug(err.Error(), "addr", addr) default: r.Logger.Error(err.Error(), "addr", addr)