diff options
Diffstat (limited to 'src/swarm/auth.rs')
| -rw-r--r-- | src/swarm/auth.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/swarm/auth.rs b/src/swarm/auth.rs index 31230a5..1bca60d 100644 --- a/src/swarm/auth.rs +++ b/src/swarm/auth.rs @@ -19,6 +19,7 @@ use std::path::Path; use std::sync::Mutex; use std::time::{Duration, Instant}; +use crate::locks::MutexExt; use anyhow::{Context, Result, bail}; use sha2::{Digest, Sha256}; @@ -67,10 +68,7 @@ impl SwarmKey { /// Records a rejected handshake. Returns how many went unlogged since the last log /// line if this one should be logged, None if it should be suppressed. pub(crate) fn note_rejection(&self) -> Option<u64> { - let mut rejections = self - .rejections - .lock() - .unwrap_or_else(|poisoned| poisoned.into_inner()); + let mut rejections = self.rejections.lock_or_recover(); let due = rejections .last_logged .is_none_or(|last| last.elapsed() >= REJECTION_LOG_INTERVAL); |
