summaryrefslogtreecommitdiffstats
path: root/src/transport/paths.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/paths.rs')
-rw-r--r--src/transport/paths.rs20
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
}