summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/vanguards.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tor-guardmgr/src/vanguards.rs')
-rw-r--r--crates/tor-guardmgr/src/vanguards.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/tor-guardmgr/src/vanguards.rs b/crates/tor-guardmgr/src/vanguards.rs
index 12925686f..5d8f5d401 100644
--- a/crates/tor-guardmgr/src/vanguards.rs
+++ b/crates/tor-guardmgr/src/vanguards.rs
@@ -460,13 +460,15 @@ impl<R: Runtime> VanguardMgr<R> {
netdir_provider: &Arc<dyn NetDirProvider>,
now: SystemTime,
) -> Result<Option<Duration>, VanguardMgrError> {
- info!("Rotating vanguards");
-
let mut inner = self.inner.write().expect("poisoned lock");
let inner = &mut *inner;
let vanguard_sets = &mut inner.vanguard_sets;
- vanguard_sets.remove_expired(now);
+ let expired_count = vanguard_sets.remove_expired(now);
+
+ if expired_count > 0 {
+ info!("Rotating vanguards");
+ }
if let Some(netdir) = Self::timely_netdir(netdir_provider)? {
// If we have a NetDir, replenish the vanguard sets that don't have enough vanguards.
@@ -548,7 +550,7 @@ impl Inner {
match self.mode {
VanguardMode::Lite | VanguardMode::Disabled => Ok(()),
VanguardMode::Full => {
- debug!("The vanguards have changed; flushing vanguards to vanguard state file");
+ debug!("The vanguards may have changed; flushing to vanguard state file");
Ok(storage.store(&self.vanguard_sets)?)
}
}