Skip to content

Commit

Permalink
[log] log too much peers (#3936)
Browse files Browse the repository at this point in the history
* [log] log too much peers
* fix go import
Signed-off-by: Leo Chen <[email protected]>
Co-authored-by: Nita Neou <[email protected]>
  • Loading branch information
Leo Chen authored Nov 23, 2021
1 parent d5a8969 commit 80b8333
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions p2p/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"sync"

"github.com/harmony-one/harmony/internal/utils"
libp2p_network "github.com/libp2p/go-libp2p-core/network"
ma "github.com/multiformats/go-multiaddr"
"github.com/pkg/errors"
Expand Down Expand Up @@ -54,6 +55,8 @@ func (m *Manager) OnConnectCheck(net libp2p_network.Network, conn libp2p_network
}

if len(peers) > m.maxConnPerIP {
utils.Logger().Warn().Int("len(peers)", len(peers)).Int("maxConnPerIP", m.maxConnPerIP).
Msg("Too much peers, closing")
return net.ClosePeer(conn.RemotePeer())
}

Expand Down

0 comments on commit 80b8333

Please sign in to comment.