From c4f9e77f34b3923f85a29ba347c875aa69e55bc1 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Wed, 15 May 2024 21:13:01 +0300 Subject: [PATCH] node: decrease default inbound connections amount --- src/node/config.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/node/config.rs b/src/node/config.rs index a5d87e6..d457ef4 100644 --- a/src/node/config.rs +++ b/src/node/config.rs @@ -17,6 +17,7 @@ use std::io::{BufRead, BufReader, Write}; use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpListener, ToSocketAddrs}; use std::path::PathBuf; use std::str::FromStr; +use egui::os::OperatingSystem; use local_ip_address::list_afinet_netifas; use serde::{Deserialize, Serialize}; @@ -185,7 +186,14 @@ impl NodeConfig { // Generate random p2p and api ports. Self::setup_default_ports(&mut config); - // Increase default amount of peers. + // Change default amount of peers. + let os = OperatingSystem::from_target_os(); + let max_inbound = if os == OperatingSystem::Android { + 24 + } else { + 96 + }; + config.server.p2p_config.peer_max_inbound_count = Some(max_inbound); config.server.p2p_config.peer_max_outbound_count = Some(24); config.server.p2p_config.peer_min_preferred_outbound_count = Some(18);