diff options
Diffstat (limited to 'src/swarm/links.rs')
| -rw-r--r-- | src/swarm/links.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/swarm/links.rs b/src/swarm/links.rs index 333fc8f..435a953 100644 --- a/src/swarm/links.rs +++ b/src/swarm/links.rs @@ -118,8 +118,10 @@ pub(crate) async fn own_links(state: &AppState) -> Vec<Link> { relayed: destination .as_ref() .is_some_and(|destination| destination.connection == Some(Connection::Relayed)), - rtt_us: rtt_of(destination.as_ref()) - .or_else(|| state.transport.rtt(&peer)) + // The path in use's (`Transport::rtt`, the first of `destination.paths`). + rtt_us: state + .transport + .rtt(&peer) .map(|rtt| u32::try_from(rtt.as_micros()).unwrap_or(u32::MAX)), dormant, peer, @@ -172,16 +174,6 @@ fn others(destination: Option<&Destination>, used: Option<&str>) -> Vec<OtherPat others } -/// The round-trip time of the path messages to the peer go over (`destination`'s -/// first path, best first), if measured: `Transport::rtt` takes the first address the -/// peer proved itself at, which needn't be the one in use. -fn rtt_of(destination: Option<&Destination>) -> Option<Duration> { - let path = destination?.paths.first()?; - path.rtt_ms - .filter(|ms| ms.is_finite() && *ms >= 0.0) - .map(|ms| Duration::from_secs_f64(ms / 1000.0)) -} - /// Asks `member` for its links (a LINKS), and with `subscribe` for its changes for /// that long; its replies land in `AppState::links`. #[cfg_attr(not(feature = "dashboard"), allow(dead_code))] |
