Skip to content

Commit

Permalink
fix(libp2p): reduce connection limits (#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 authored Nov 19, 2023
1 parent 470bf5f commit 911daab
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/libp2p/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,30 @@ impl ForestBehaviour {
.target_peer_count(config.target_peer_count as u64)
.finish()?;

const MAX_ESTABLISHED_PER_PEER: u32 = 4;
let connection_limits = connection_limits::Behaviour::new(
connection_limits::ConnectionLimits::default()
.with_max_pending_incoming(Some(4096))
.with_max_pending_outgoing(Some(8192))
.with_max_established_incoming(Some(8192))
.with_max_established_outgoing(Some(8192))
.with_max_established_per_peer(Some(5)),
.with_max_pending_incoming(Some(
config
.target_peer_count
.saturating_mul(MAX_ESTABLISHED_PER_PEER),
))
.with_max_pending_outgoing(Some(
config
.target_peer_count
.saturating_mul(MAX_ESTABLISHED_PER_PEER),
))
.with_max_established_incoming(Some(
config
.target_peer_count
.saturating_mul(MAX_ESTABLISHED_PER_PEER),
))
.with_max_established_outgoing(Some(
config
.target_peer_count
.saturating_mul(MAX_ESTABLISHED_PER_PEER),
))
.with_max_established_per_peer(Some(MAX_ESTABLISHED_PER_PEER)),
);

info!("libp2p Forest version: {}", FOREST_VERSION_STRING.as_str());
Expand Down

0 comments on commit 911daab

Please sign in to comment.