Skip to content
Snippets Groups Projects
Unverified Commit 255afe1f authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

litep2p: Increase keep-alive to 10 seconds to mirror libp2p (#7488)

This PR ensures that litep2p will keep an idle connection alive for 10
seconds.

The bump from 5 seconds is done to mirror the libp2p behavior and
potentially improve connection stability:

https://github.com/paritytech/polkadot-sdk/blob/a07fb323

/substrate/client/network/src/service.rs#L542-L549

cc @paritytech/networking

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
parent 87f4f3f0
No related merge requests found
Pipeline #514492 waiting for manual action with stages
in 30 minutes and 44 seconds
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
......@@ -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 {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment