aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/traffic.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 21:39:21 +0100
committertv <tv@krebsco.de>2026-11-01 21:39:21 +0100
commitabc3f66b13daeeb55204c5a5b47152b136ce684d (patch)
tree54e4d29390539d18fdcd52e51e3b3011e513ea22 /src/transport/traffic.rs
parent98b49df1e7631f99b0ad780fb0f01924cebd0756 (diff)
ping & pong are tied by nonce only
Diffstat (limited to 'src/transport/traffic.rs')
-rw-r--r--src/transport/traffic.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs
index 2e45a31..041471d 100644
--- a/src/transport/traffic.rs
+++ b/src/transport/traffic.rs
@@ -137,7 +137,8 @@ pub(crate) struct Logged {
}
/// What ties `message`, with `peer`, to other messages: a PING and its PONG (the
-/// nonce), a LINKS and its replies (the nonce), a HELLO and its replies (the run of the
+/// nonce alone: a PING may go to an address and its PONG come back up from the node
+/// there, `paths`), a LINKS and its replies (the nonce), a HELLO and its replies (the run of the
/// node that sent the HELLO, which the reply echoes), a blob's requests and answers, from
/// any peer (its ID), and a delta offered in a SYNC with the blob it is fetched as. None
/// for the rest (a STATUS and its reply carry nothing of the kind).
@@ -145,7 +146,7 @@ fn related(peer: &str, message: &ParsedMessage) -> Option<String> {
use crate::transport::{Hex, SyncBody};
Some(match message {
ParsedMessage::Ping(nonce) | ParsedMessage::Pong { nonce, .. } => {
- format!("ping {peer} {nonce}")
+ format!("ping {nonce}")
}
ParsedMessage::Links(request) => format!("links {peer} {}", request.nonce),
ParsedMessage::LinksReply(reply) => format!("links {peer} {}", reply.nonce),
@@ -173,7 +174,13 @@ impl MessageLog {
}
}
- fn note(&self, way: &'static str, peer: &str, message: &ParsedMessage, bytes: usize) {
+ pub(crate) fn note(
+ &self,
+ way: &'static str,
+ peer: &str,
+ message: &ParsedMessage,
+ bytes: usize,
+ ) {
if !self.watching.load(Ordering::Relaxed) {
return;
}