From db7608e3b5b76ccefe3a76bf8f9c8958ddbaada2 Mon Sep 17 00:00:00 2001 From: Will Smith <44074786+Will-Smith11@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:29:20 -0500 Subject: [PATCH] feat(net): expose config settings (#386) * expose transaction origin * feat(net): fill peer config builder --- crates/net/network/src/peers/manager.rs | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/net/network/src/peers/manager.rs b/crates/net/network/src/peers/manager.rs index 5ad4187ff2..90fa352c85 100644 --- a/crates/net/network/src/peers/manager.rs +++ b/crates/net/network/src/peers/manager.rs @@ -494,6 +494,34 @@ impl PeersConfig { self.ban_list = ban_list; self } + + /// Maximum occupied slots for outbound connections. + pub fn with_max_pending_outbound(mut self, num_outbound: usize) -> Self { + self.connection_info.num_inbound = num_outbound; + self + } + + /// Maximum occupied slots for inbound connections. + pub fn with_max_pending_inbound(mut self, num_inbound: usize) -> Self { + self.connection_info.num_inbound = num_inbound; + self + } + /// Maximum allowed outbound connections. + pub fn with_max_outbound(mut self, max_outbound: usize) -> Self { + self.connection_info.max_outbound = max_outbound; + self + } + /// Maximum allowed inbound connections. + pub fn with_max_inbound(mut self, max_inbound: usize) -> Self { + self.connection_info.max_inbound = max_inbound; + self + } + + /// How often to recheck free slots for outbound connections + pub fn with_slot_refill_interval(mut self, interval: Duration) -> Self { + self.refill_slots_interval = interval; + self + } } /// Configuration for the automatic removal of unwanted peers