Browse Source

p2p: change some logs from Error to Debug. #1476

pull/1519/head
Ethan Buchman 7 years ago
parent
commit
6805ddf1b8
2 changed files with 19 additions and 21 deletions
  1. +13
    -18
      p2p/pex/pex_reactor.go
  2. +6
    -3
      p2p/switch.go

+ 13
- 18
p2p/pex/pex_reactor.go View File

@ -181,16 +181,19 @@ func (r *PEXReactor) AddPeer(p Peer) {
// add to book. dont RequestAddrs right away because
// we don't trust inbound as much - let ensurePeersRoutine handle it.
err := r.book.AddAddress(addr, src)
if err != nil {
switch err.(type) {
case ErrAddrBookNilAddr:
r.Logger.Error("Failed to add new address", "err", err)
default:
// non-routable, self, full book, etc.
r.Logger.Debug("Failed to add new address", "err", err)
}
}
r.logErrAddrBook(err)
}
}
func (r *PEXReactor) logErrAddrBook(err error) {
if err != nil {
switch err.(type) {
case ErrAddrBookNilAddr:
r.Logger.Error("Failed to add new address", "err", err)
default:
// non-routable, self, full book, etc.
r.Logger.Debug("Failed to add new address", "err", err)
}
}
}
@ -313,15 +316,7 @@ func (r *PEXReactor) ReceiveAddrs(addrs []*p2p.NetAddress, src Peer) error {
}
err := r.book.AddAddress(netAddr, srcAddr)
if err != nil {
switch err.(type) {
case ErrAddrBookNilAddr:
r.Logger.Error("Failed to add new address", "err", err)
default:
// Could be non-routable, self, or full book. But not worth logging an Error
r.Logger.Debug("Failed to add new address", "err", err)
}
}
r.logErrAddrBook(err)
}
return nil
}


+ 6
- 3
p2p/switch.go View File

@ -401,7 +401,12 @@ func (sw *Switch) DialPeersAsync(addrBook AddrBook, peers []string, persistent b
sw.randomSleep(0)
err := sw.DialPeerWithAddress(addr, persistent)
if err != nil {
sw.Logger.Error("Error dialing peer", "err", err)
switch err.(type) {
case ErrSwitchConnectToSelf, ErrSwitchDuplicatePeer:
sw.Logger.Debug("Error dialing peer", "err", err)
default:
sw.Logger.Error("Error dialing peer", "err", err)
}
}
}(i)
}
@ -500,7 +505,6 @@ func (sw *Switch) addOutboundPeerWithConfig(addr *NetAddress, config *PeerConfig
sw.Logger.Info("Dialing peer", "address", addr)
peerConn, err := newOutboundPeerConn(addr, config, persistent, sw.nodeKey.PrivKey)
if err != nil {
sw.Logger.Error("Failed to dial peer", "address", addr, "err", err)
if persistent {
go sw.reconnectToPeer(addr)
}
@ -508,7 +512,6 @@ func (sw *Switch) addOutboundPeerWithConfig(addr *NetAddress, config *PeerConfig
}
if err := sw.addPeer(peerConn); err != nil {
sw.Logger.Error("Failed to add peer", "address", addr, "err", err)
peerConn.CloseConn()
return err
}


Loading…
Cancel
Save