network: log peerCount on connection registration
Symmetrical to disconnects, make it easier to look through the logs.
This commit is contained in:
parent
32695b4f40
commit
49bd7aada5
1 changed files with 1 additions and 1 deletions
|
@ -214,8 +214,8 @@ func (s *Server) run() {
|
||||||
s.lock.Lock()
|
s.lock.Lock()
|
||||||
s.peers[p] = true
|
s.peers[p] = true
|
||||||
s.lock.Unlock()
|
s.lock.Unlock()
|
||||||
s.log.Info("new peer connected", zap.Stringer("addr", p.RemoteAddr()))
|
|
||||||
peerCount := s.PeerCount()
|
peerCount := s.PeerCount()
|
||||||
|
s.log.Info("new peer connected", zap.Stringer("addr", p.RemoteAddr()), zap.Int("peerCount", peerCount))
|
||||||
if peerCount > s.MaxPeers {
|
if peerCount > s.MaxPeers {
|
||||||
s.lock.RLock()
|
s.lock.RLock()
|
||||||
// Pick a random peer and drop connection to it.
|
// Pick a random peer and drop connection to it.
|
||||||
|
|
Loading…
Reference in a new issue