network: log peerCount on connection registration

Symmetrical to disconnects, make it easier to look through the logs.
This commit is contained in:
Roman Khimov 2020-01-28 19:39:12 +03:00
parent 32695b4f40
commit 49bd7aada5

View file

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