Skip to content

Commit

Permalink
fix(libp2p): Swarm keeps connections alive forever instead of ping be…
Browse files Browse the repository at this point in the history
…haviour

See: libp2p/rust-libp2p#2859
  • Loading branch information
binarybaron committed Oct 24, 2024
1 parent fcce5f7 commit dfd6180
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions swap/src/network/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use libp2p::swarm::NetworkBehaviour;
use libp2p::SwarmBuilder;
use libp2p::{identity, Multiaddr, Swarm};
use std::fmt::Debug;
use std::time::Duration;

#[allow(clippy::too_many_arguments)]
pub fn asb<LR>(
Expand Down Expand Up @@ -52,6 +53,7 @@ where
.with_tokio()
.with_other_transport(|_| transport)?
.with_behaviour(|_| behaviour)?
.with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::MAX))
.build();

Ok(swarm)
Expand All @@ -76,6 +78,7 @@ where
.with_tokio()
.with_other_transport(|_| transport)?
.with_behaviour(|_| behaviour)?
.with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::MAX))
.build();

Ok(swarm)
Expand Down

0 comments on commit dfd6180

Please sign in to comment.