From 49bd7aada5c300fb531e086390fd38407370b244 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 28 Jan 2020 19:39:12 +0300 Subject: [PATCH] network: log peerCount on connection registration Symmetrical to disconnects, make it easier to look through the logs. --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 528908a40..63d3703a8 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -214,8 +214,8 @@ func (s *Server) run() { s.lock.Lock() s.peers[p] = true s.lock.Unlock() - s.log.Info("new peer connected", zap.Stringer("addr", p.RemoteAddr())) peerCount := s.PeerCount() + s.log.Info("new peer connected", zap.Stringer("addr", p.RemoteAddr()), zap.Int("peerCount", peerCount)) if peerCount > s.MaxPeers { s.lock.RLock() // Pick a random peer and drop connection to it.