p2p: add more info to peer addition and removal logs (#19712)

This commit is contained in:
Felix Lange 2019-06-13 11:51:12 +02:00 committed by Martin Holst Swende
parent c8c3ebd593
commit f213ceb83f

View File

@ -744,7 +744,7 @@ running:
p.events = &srv.peerFeed
}
name := truncateName(c.name)
srv.log.Debug("Adding p2p peer", "name", name, "addr", c.fd.RemoteAddr(), "peers", len(peers)+1)
p.log.Debug("Adding p2p peer", "addr", p.RemoteAddr(), "peers", len(peers)+1, "name", name)
go srv.runPeer(p)
peers[c.node.ID()] = p
if p.Inbound() {
@ -759,7 +759,7 @@ running:
case pd := <-srv.delpeer:
// A peer disconnected.
d := common.PrettyDuration(mclock.Now() - pd.created)
pd.log.Debug("Removing p2p peer", "duration", d, "peers", len(peers)-1, "req", pd.requested, "err", pd.err)
pd.log.Debug("Removing p2p peer", "addr", pd.RemoteAddr(), "peers", len(peers)-1, "duration", d, "req", pd.requested, "err", pd.err)
delete(peers, pd.ID())
if pd.Inbound() {
inboundCount--