Instruct Ping to keep the connection alive

This commit is contained in:
Thomas Eizinger 2021-08-18 12:39:06 +10:00
parent 1af0623c85
commit 6c446825b7
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
3 changed files with 11 additions and 4 deletions

View file

@ -5,7 +5,7 @@ use crate::protocol::bob::State2;
use crate::{bitcoin, env};
use anyhow::{anyhow, Error, Result};
use libp2p::core::Multiaddr;
use libp2p::ping::{Ping, PingEvent};
use libp2p::ping::{Ping, PingConfig, PingEvent};
use libp2p::request_response::{RequestId, ResponseChannel};
use libp2p::{NetworkBehaviour, PeerId};
use std::sync::Arc;
@ -83,7 +83,7 @@ impl Behaviour {
transfer_proof: transfer_proof::bob(),
encrypted_signature: encrypted_signature::bob(),
redial: redial::Behaviour::new(alice, Duration::from_secs(2)),
ping: Ping::default(),
ping: Ping::new(PingConfig::new().with_keep_alive(true)),
}
}