mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
eth: hack to limit number of eth peers
This commit is contained in:
parent
785439d088
commit
f085237df3
1 changed files with 4 additions and 0 deletions
|
|
@ -249,6 +249,10 @@ func (pm *ProtocolManager) newPeer(pv int, p *p2p.Peer, rw p2p.MsgReadWriter) *p
|
||||||
// handle is the callback invoked to manage the life cycle of an eth peer. When
|
// handle is the callback invoked to manage the life cycle of an eth peer. When
|
||||||
// this function terminates, the peer is disconnected.
|
// this function terminates, the peer is disconnected.
|
||||||
func (pm *ProtocolManager) handle(p *peer) error {
|
func (pm *ProtocolManager) handle(p *peer) error {
|
||||||
|
if pm.peers.Len() >= 20 {
|
||||||
|
return p2p.DiscTooManyPeers
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(logger.Debug).Infof("%v: peer connected [%s]", p, p.Name())
|
glog.V(logger.Debug).Infof("%v: peer connected [%s]", p, p.Name())
|
||||||
|
|
||||||
// Execute the Ethereum handshake
|
// Execute the Ethereum handshake
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue