From 5184885fcec433d636060e5a4e889fa78827dadc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 28 Oct 2026 03:32:32 +0100 Subject: register PING before sending it --- src/transport/paths.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/transport/paths.rs b/src/transport/paths.rs index 6d4b3a3..643a238 100644 --- a/src/transport/paths.rs +++ b/src/transport/paths.rs @@ -222,6 +222,8 @@ impl Table { self.counts.send_failures += 1; if let Some(path) = self.paths.get_mut(address) { path.failed_at = Some(now); + // A PING that didn't go out gets no answer; it is no unanswered one. + path.probe = None; } } @@ -557,13 +559,17 @@ impl Paths { } } }; + // A PING is noted before it goes: on a fast link, its PONG may be back + // before the send returns. + if let Some(ParsedMessage::Ping(nonce)) = message.message.as_deref() { + self.table + .lock_or_recover() + .pinged(address, *nonce, Instant::now()); + } match self.send(&encoded).await { Ok(()) => { let mut table = self.table.lock_or_recover(); table.sent(address); - if let Some(ParsedMessage::Ping(nonce)) = message.message.as_deref() { - table.pinged(address, *nonce, Instant::now()); - } if !failures.is_empty() { table.counts.failovers += 1; drop(table); -- cgit v1.3.1