summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 05:16:15 +0200
committertv <tv@krebsco.de>2026-10-20 05:16:15 +0200
commitd64dc446e3e4f23c17062ff35eca3e392e263794 (patch)
treefb4653d35bcc94f933d632181787674fe71d0b3b /src/state.rs
parent220d24482a67f6e3edb2784343a4063860dbb7af (diff)
take_keepalive_due: consider added_at
This prevents an immediate ping during handshake.
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs
index ad7b664..a694fd0 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