From febb300a2d3c62ef01be801e4a83375fe9c948c7 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Wed, 29 Jul 2020 06:39:30 +0000 Subject: [PATCH] Limit incoming connection requests (#1413) ## Issue Addressed Limits the number of incoming connections and adjusts the buffer sizes in libp2p --- beacon_node/eth2_libp2p/src/service.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beacon_node/eth2_libp2p/src/service.rs b/beacon_node/eth2_libp2p/src/service.rs index 965c6d849..363e740c7 100644 --- a/beacon_node/eth2_libp2p/src/service.rs +++ b/beacon_node/eth2_libp2p/src/service.rs @@ -103,6 +103,9 @@ impl Service { } } SwarmBuilder::new(transport, behaviour, local_peer_id.clone()) + .notify_handler_buffer_size(std::num::NonZeroUsize::new(32).expect("Not zero")) + .connection_event_buffer_size(64) + .incoming_connection_limit(10) .peer_connection_limit(MAX_CONNECTIONS_PER_PEER) .executor(Box::new(Executor(executor))) .build()