aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/rtt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/rtt.rs')
-rw-r--r--src/swarm/rtt.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/swarm/rtt.rs b/src/swarm/rtt.rs
index 6dfe84a..60bcbc6 100644
--- a/src/swarm/rtt.rs
+++ b/src/swarm/rtt.rs
@@ -47,6 +47,17 @@ impl RttTable {
self.from_hellos.retain(|peer, _| keep(peer));
}
+ /// How many peers it holds anything of.
+ #[cfg(test)]
+ pub(crate) fn len(&self) -> usize {
+ self.hellos
+ .keys()
+ .chain(self.from_paths.keys())
+ .chain(self.from_hellos.keys())
+ .collect::<std::collections::HashSet<_>>()
+ .len()
+ }
+
/// The paths layer's round-trip time to `peer` (`Transport::rtt`), as a PONG from
/// it arrived.
pub(crate) fn measured(&mut self, peer: &str, rtt: Duration, now: Instant) {