diff options
| author | tv <tv@krebsco.de> | 2026-10-28 06:35:27 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-28 06:35:27 +0100 |
| commit | be58ebd7dc5b7e1665e4d058b03248f9035d13a6 (patch) | |
| tree | 3f198fa34cc060220c6fcc3ad4e40e091051110d /src/transport/paths.rs | |
| parent | 1673d38fb9bdc71d66cb495d9c0467bbe3c1bfcf (diff) | |
show peer destination path address in canonical form
Diffstat (limited to 'src/transport/paths.rs')
| -rw-r--r-- | src/transport/paths.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/transport/paths.rs b/src/transport/paths.rs index 1f6d078..ba16794 100644 --- a/src/transport/paths.rs +++ b/src/transport/paths.rs @@ -334,7 +334,6 @@ impl Table { let path = self.paths.get(address); PathInfo { address: address.to_owned(), - location: None, rtt_ms: path .and_then(|path| path.rtt) .map(|rtt| rtt.as_secs_f64() * 1000.0), @@ -450,13 +449,16 @@ impl Paths { self.located(infos) } - /// `infos` with where each path goes (`Transport::location`); asked outside the - /// table's lock. + /// `infos` with where each path goes, where the transport knows + /// (`Transport::location`); asked outside the table's lock. fn located(&self, mut infos: Vec<PathInfo>) -> Vec<PathInfo> { for info in &mut infos { - info.location = self + if let Some((link, location)) = self .split(&info.address) - .and_then(|(link, target)| link.inner.location(&target)); + .and_then(|(link, target)| Some((link, link.inner.location(&target)?))) + { + info.address = link.address(&location); + } } infos } @@ -658,7 +660,7 @@ impl Paths { stats.merge(link.inner.stats()); } let now = Instant::now(); - let (mut paths, counts) = { + let (paths, counts) = { let table = self.table.lock_or_recover(); let paths: Vec<PathInfo> = table .paths @@ -667,11 +669,9 @@ impl Paths { .collect(); (paths, table.counts) }; + let mut paths = self.located(paths); paths.sort_by(|a, b| a.address.cmp(&b.address)); - stats.paths = Some(PathsStats { - paths: self.located(paths), - counts, - }); + stats.paths = Some(PathsStats { paths, counts }); stats } |
