summaryrefslogtreecommitdiffstats
path: root/src/swarm/stability.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/stability.rs')
-rw-r--r--src/swarm/stability.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/swarm/stability.rs b/src/swarm/stability.rs
index 9d79b17..1ee308f 100644
--- a/src/swarm/stability.rs
+++ b/src/swarm/stability.rs
@@ -22,6 +22,7 @@ use std::time::Duration;
use tokio::time::Instant;
use tracing::{info, warn};
+use crate::locks::MutexExt;
use crate::state::{AppState, HelloState};
use crate::swarm::members::{self, Tier};
@@ -129,10 +130,7 @@ impl Stability {
}
fn lock(state: &AppState) -> std::sync::MutexGuard<'_, Stability> {
- state
- .stability
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner())
+ state.stability.lock_or_recover()
}
/// The fraction of the observed time (up to a day) we had a live peer, and how much