From 81a6e029d835f576a4303b0fc78fbd8e2f26e2a7 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 05:21:07 +0200 Subject: record RTT sampling instant --- src/api/peers.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/api/peers.rs') diff --git a/src/api/peers.rs b/src/api/peers.rs index 3893e0f..bafb5fa 100644 --- a/src/api/peers.rs +++ b/src/api/peers.rs @@ -62,8 +62,8 @@ pub(crate) struct PeerStatus { heads: Option, /// We keep it alive and sync with it on our own; other peers we only answer. neighbour: bool, - /// Smoothed round-trip time in milliseconds, from PING/PONG and HELLO/HELLO_REPLY; - /// absent until measured. + /// Effective round-trip time in milliseconds (smoothed, raised by requests still + /// unanswered); absent without a recent sample. rtt_ms: Option, } @@ -114,7 +114,7 @@ pub(crate) async fn list_peers( let neighbour = crate::swarm::topology::is_neighbour(&state, &public_key); let rtt_ms = state .lock_rtt() - .get(&public_key) + .effective(&public_key, now, state.timing.rtt_fresh_for()) .map(|rtt| rtt.as_secs_f64() * 1000.0); let ps = peer_state_mutex.lock().await; -- cgit v1.3.1