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
commitb3a38c46662d08bf97a2ed8a6bcdd43399e42e7f (patch)
tree5538dc00bd7d1f19c67cd0c85c5cfee7ff9bf116 /src/state.rs
parent42610f407dccec9b0e2ef870bb5a1ebeb70140b0 (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 4052b68..e1b613f 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