Skip to content

Commit

Permalink
Add explicit rejection of incoming peer's connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheatfate committed Jul 27, 2020
1 parent 6face7a commit 62ef619
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion beacon_chain/eth2_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,15 @@ proc handleIncomingPeer*(peer: Peer): Future[bool] {.async.} =
debug "Peer (incoming) lost", peer
nbc_peers.set int64(len(network.peerPool))

let res = await network.peerPool.addIncomingPeer(peer)
let res = network.peerPool.addIncomingPeerNoWait(peer)
if res:
peer.updateScore(NewPeerScore)
debug "Peer (incoming) has been added to PeerPool", peer
peer.getFuture().addCallback(onPeerClosed)
result = true
else:
debug "Too many incoming connections in PeerPool, disconnecting", peer
result = false

nbc_peers.set int64(len(network.peerPool))

Expand Down

0 comments on commit 62ef619

Please sign in to comment.