diff options
Diffstat (limited to 'src/swarm/stability.rs')
| -rw-r--r-- | src/swarm/stability.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/swarm/stability.rs b/src/swarm/stability.rs index 31ba4b8..9d79b17 100644 --- a/src/swarm/stability.rs +++ b/src/swarm/stability.rs @@ -135,6 +135,13 @@ fn lock(state: &AppState) -> std::sync::MutexGuard<'_, Stability> { .unwrap_or_else(|poisoned| poisoned.into_inner()) } +/// The fraction of the observed time (up to a day) we had a live peer, and how much +/// time was observed. +pub(crate) fn measured(state: &AppState) -> (f64, Duration) { + let stability = lock(state); + (stability.fraction(), stability.observed()) +} + /// A HELLO_REPLY told us how long ago that peer last heard from us before this run. pub(crate) fn note_away(state: &AppState, away: Option<Duration>) { if let Some(away) = away { |
