summaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-28 03:32:32 +0100
committertv <tv@krebsco.de>2026-10-28 03:32:32 +0100
commit5184885fcec433d636060e5a4e889fa78827dadc (patch)
treee8424802dcee636026f1ae82c41c137588a20404 /src/transport
parent30c2ca8537fbc2874ec6e14cdd1ae5477c95f099 (diff)
register PING before sending it
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/paths.rs12
1 files changed, 9 insertions, 3 deletions
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);