summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 05:16:15 +0200
committertv <tv@krebsco.de>2026-10-20 06:12:35 +0200
commitce30784051e0b95a194c980e90b675afbc51d288 (patch)
tree2afc7692ef2a80267537da9e7b1eabcb57065a12
parentb3d86d1d487ec6c77c84e0721442e8089075f95f (diff)
take_keepalive_due: consider added_at
This prevents an immediate ping during handshake.
-rw-r--r--src/state.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs
index 81663f3..a8b573b 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -179,6 +179,7 @@ impl PeerState {
pub(crate) fn take_keepalive_due(&mut self, timing: &Timing, now: Instant) -> bool {
let due = self.liveness == Liveness::Active
&& self.hello_state == HelloState::Established
+ && now.saturating_duration_since(self.added_at) >= timing.keepalive
&& self.quiet_for(now) >= timing.keepalive
&& self
.last_ping_at