Skip to content

Commit dfd6180

Browse files
committed
fix(libp2p): Swarm keeps connections alive forever instead of ping behaviour
See: libp2p/rust-libp2p#2859
1 parent fcce5f7 commit dfd6180

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

swap/src/network/swarm.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use libp2p::swarm::NetworkBehaviour;
88
use libp2p::SwarmBuilder;
99
use libp2p::{identity, Multiaddr, Swarm};
1010
use std::fmt::Debug;
11+
use std::time::Duration;
1112

1213
#[allow(clippy::too_many_arguments)]
1314
pub fn asb<LR>(
@@ -52,6 +53,7 @@ where
5253
.with_tokio()
5354
.with_other_transport(|_| transport)?
5455
.with_behaviour(|_| behaviour)?
56+
.with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::MAX))
5557
.build();
5658

5759
Ok(swarm)
@@ -76,6 +78,7 @@ where
7678
.with_tokio()
7779
.with_other_transport(|_| transport)?
7880
.with_behaviour(|_| behaviour)?
81+
.with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::MAX))
7982
.build();
8083

8184
Ok(swarm)

0 commit comments

Comments
 (0)