diff options
| author | tv <tv@krebsco.de> | 2026-11-06 04:34:44 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-06 04:34:44 +0100 |
| commit | 0ac2a86253349a2d05874d258a179b5f73697dc5 (patch) | |
| tree | 03acfc03e6f2341e3cd34965fd9a274da54fed3f /src/state | |
| parent | d6f6c2e020ac648b54c0e024596460ffb82ca437 (diff) | |
worker sends off the pass
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/peer.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/state/peer.rs b/src/state/peer.rs index 857c29d..2f027ba 100644 --- a/src/state/peer.rs +++ b/src/state/peer.rs @@ -104,6 +104,9 @@ pub(crate) struct PeerState { pub(crate) last_seen: Option<Instant>, /// Our last keepalive to it (a PING or a STATUS). pub(crate) last_keepalive_at: Option<Instant>, + /// The peer worker's sends to it (a keepalive, a HELLO again) are on their way, off + /// the worker's pass (`swarm::peer::run_peer_worker`): none more until they are. + pub(crate) worker_sending: bool, /// Its last keepalive to us (a PING or a STATUS): after it, the next is ours. pub(crate) keepalive_received_at: Option<Instant>, /// The last STATUS between us, either way (`status_refresh`). @@ -288,6 +291,7 @@ impl PeerState { added_at: Instant::now(), last_seen: None, last_keepalive_at: None, + worker_sending: false, keepalive_received_at: None, last_status_at: None, awaiting_answer: None, @@ -640,7 +644,8 @@ impl PeerState { ) -> Option<Instant> { let dormancy = (ready && neighbour && !self.liveness.is_dormant()) .then(|| self.last_seen.unwrap_or(self.added_at) + timing.dormant_after); - let keepalive = if neighbour { + // Not while the worker's sends to it are on their way: after them (they wake it). + let keepalive = if neighbour && !self.worker_sending { self.keepalive_due_at(timing) } else { None |
