diff options
author | Alex Auvolat <alex@adnab.me> | 2022-08-31 16:25:36 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-08-31 16:25:36 +0200 |
commit | 77036597425c24a4e618974dca8eaf9e916e9570 (patch) | |
tree | d0691f4b08720d745cca2940398ee61db0b62ba8 /src/peering | |
parent | 984ba65e658a920f2d8e67ce808e9acd257c4d86 (diff) | |
download | netapp-77036597425c24a4e618974dca8eaf9e916e9570.tar.gz netapp-77036597425c24a4e618974dca8eaf9e916e9570.zip |
Be more lenient on pings
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); } } |