From a07fb323bc0cfb5c2fb4c8fbe9d20e344cc8eeaf Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <alexandru.vasile@parity.io> Date: Wed, 5 Feb 2025 17:27:44 +0200 Subject: [PATCH] litep2p: Increase keep-alive to 10 seconds to mirror libp2p Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --- substrate/client/network/src/litep2p/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/substrate/client/network/src/litep2p/mod.rs b/substrate/client/network/src/litep2p/mod.rs index fc4cce47628..e8e132228ca 100644 --- a/substrate/client/network/src/litep2p/mod.rs +++ b/substrate/client/network/src/litep2p/mod.rs @@ -100,6 +100,9 @@ mod peerstore; mod service; mod shim; +/// Timeout for connection waiting new substreams. +const KEEP_ALIVE_TIMEOUT: Duration = Duration::from_secs(10); + /// Litep2p bandwidth sink. struct Litep2pBandwidthSink { sink: litep2p::BandwidthSink, @@ -566,6 +569,9 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkBackend<B, H> for Litep2pNetworkBac .with_connection_limits(ConnectionLimitsConfig::default().max_incoming_connections( Some(crate::MAX_CONNECTIONS_ESTABLISHED_INCOMING as usize), )) + // This has the same effect as `libp2p::Swarm::with_idle_connection_timeout` which is + // set to 10 seconds as well. + .with_keep_alive_timeout(KEEP_ALIVE_TIMEOUT) .with_executor(executor); if let Some(config) = maybe_mdns_config { -- GitLab