diff options
Diffstat (limited to 'src/peering')
-rw-r--r-- | src/peering/fullmesh.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs index b1c94af..208cfe4 100644 --- a/src/peering/fullmesh.rs +++ b/src/peering/fullmesh.rs @@ -22,10 +22,10 @@ use crate::NodeID; const CONN_RETRY_INTERVAL: Duration = Duration::from_secs(30); const CONN_MAX_RETRIES: usize = 10; -const PING_INTERVAL: Duration = Duration::from_secs(10); +const PING_INTERVAL: Duration = Duration::from_secs(15); const LOOP_DELAY: Duration = Duration::from_secs(1); -const PING_TIMEOUT: Duration = Duration::from_secs(5); -const FAILED_PING_THRESHOLD: usize = 3; +const PING_TIMEOUT: Duration = Duration::from_secs(10); +const FAILED_PING_THRESHOLD: usize = 4; // -- Protocol messages -- @@ -255,15 +255,11 @@ impl FullMeshPeeringStrategy { trace!("{}, {:?}", hex::encode(&id[..8]), info); match info.state { PeerConnState::Connected => { - let must_ping = match info.last_seen { + let must_ping = match info.last_send_ping { None => true, Some(t) => Instant::now() - t > PING_INTERVAL, }; - let pinged_recently = match info.last_send_ping { - None => false, - Some(t) => Instant::now() - t < PING_TIMEOUT, - }; - if must_ping && !pinged_recently { + if must_ping { to_ping.push(*id); } } |