aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/paths.rs
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
commit3fa8f9e360f0f7384986f2814f82b1124c25b8da (patch)
tree54ec24006b84b7a9823784063b56af792acc079e /src/transport/paths.rs
parent56c792a866d28442ac0bd8a9c261d5e0c927c5db (diff)
register PING before sending it
Diffstat (limited to 'src/transport/paths.rs')
-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 09c446a..f5ea7a2 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);