summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);