feat(cli): add max peer args (#4024)

This commit is contained in:
Altuğ Bakan
2023-08-01 20:44:39 +02:00
committed by GitHub
parent bfbad261ec
commit b46101afb5
2 changed files with 54 additions and 5 deletions

View File

@ -1134,11 +1134,29 @@ impl PeersConfig {
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 with optional update.
pub fn with_max_inbound_opt(mut self, max_inbound: Option<usize>) -> Self {
if let Some(max_inbound) = max_inbound {
self.connection_info.max_inbound = max_inbound;
}
self
}
/// Maximum allowed outbound connections with optional update.
pub fn with_max_outbound_opt(mut self, max_outbound: Option<usize>) -> Self {
if let Some(max_outbound) = max_outbound {
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;