mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-01-11 21:44:24 +00:00
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:
parent
fb0d10b6fd
commit
dffe4bed45
@ -25,7 +25,7 @@ declareGauge(libp2p_peers, "total connected peers")
|
|||||||
|
|
||||||
const
|
const
|
||||||
MaxConnections* = 50
|
MaxConnections* = 50
|
||||||
MaxConnectionsPerPeer* = 5
|
MaxConnectionsPerPeer* = 1
|
||||||
|
|
||||||
type
|
type
|
||||||
TooManyConnectionsError* = object of LPError
|
TooManyConnectionsError* = object of LPError
|
||||||
|
@ -562,6 +562,7 @@ suite "Switch":
|
|||||||
conns.dec
|
conns.dec
|
||||||
|
|
||||||
switches.add(newStandardSwitch(
|
switches.add(newStandardSwitch(
|
||||||
|
maxConnsPerPeer = 10,
|
||||||
rng = rng))
|
rng = rng))
|
||||||
|
|
||||||
switches[0].addConnEventHandler(hook, ConnEventKind.Connected)
|
switches[0].addConnEventHandler(hook, ConnEventKind.Connected)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user