mitigate high traffic - drop faulty peers (#460)

Only allow 1 connection per peer

Co-authored-by: Tanguy <tanguy@status.im>
This commit is contained in:
Dmitriy Ryajov 2022-01-04 05:21:24 -06:00 committed by GitHub
parent fb0d10b6fd
commit dffe4bed45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ declareGauge(libp2p_peers, "total connected peers")
const
MaxConnections* = 50
MaxConnectionsPerPeer* = 5
MaxConnectionsPerPeer* = 1
type
TooManyConnectionsError* = object of LPError

View File

@ -562,6 +562,7 @@ suite "Switch":
conns.dec
switches.add(newStandardSwitch(
maxConnsPerPeer = 10,
rng = rng))
switches[0].addConnEventHandler(hook, ConnEventKind.Connected)