diff options
Diffstat (limited to 'src/transport/libp2p/behaviour.rs')
| -rw-r--r-- | src/transport/libp2p/behaviour.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/transport/libp2p/behaviour.rs b/src/transport/libp2p/behaviour.rs index 18d8011..0b9be6b 100644 --- a/src/transport/libp2p/behaviour.rs +++ b/src/transport/libp2p/behaviour.rs @@ -188,6 +188,8 @@ pub(super) struct Features { pub(super) mdns: bool, pub(super) upnp: bool, pub(super) public: bool, + /// How long a connection may idle (`idle_timeout`). + pub(super) idle_timeout: Duration, } impl Features { @@ -197,6 +199,7 @@ impl Features { mdns: config.mdns, upnp: config.upnp, public: config.public, + idle_timeout: idle_timeout(config.keepalive), } } } @@ -228,6 +231,7 @@ impl Behaviour { mdns, upnp, public, + idle_timeout: _, } = features; let peer_id = key.public().to_peer_id(); let kad = public.then(|| { @@ -335,7 +339,7 @@ pub(super) fn swarm_config( features: Features, ) -> ::libp2p::swarm::Config { let config = config - .with_idle_connection_timeout(IDLE_TIMEOUT) + .with_idle_connection_timeout(features.idle_timeout) .with_dial_concurrency_factor(DIAL_CONCURRENCY); if features.public { config |
