diff --git a/prdoc/pr_7488.prdoc b/prdoc/pr_7488.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..55ce87d42d86dff00dca7d1b172fe7bbbf76a589 --- /dev/null +++ b/prdoc/pr_7488.prdoc @@ -0,0 +1,10 @@ +title: Increase litep2p keep-alive to 10 seconds to mirror libp2p + +doc: + - audience: [Node Dev, Node Operator] + description: | + Increase litep2p keep-alive to 10 seconds to mirror libp2p behavior. + +crates: + - name: sc-network + bump: patch diff --git a/substrate/client/network/src/litep2p/mod.rs b/substrate/client/network/src/litep2p/mod.rs index fc4cce47628396bd22c8785edd18227c27a7326a..e8e132228ca8f82d1a32ff2508b5fe84efc242ca 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 {