summaryrefslogtreecommitdiffstats
path: root/src/swarm/peer.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-23 23:15:59 +0200
committertv <tv@krebsco.de>2026-10-23 23:15:59 +0200
commit52939e2c27b9ce5de318366d770f8f0a827fdd21 (patch)
tree3b9cdf37e1399a0a73bfed126abc9725297d36f9 /src/swarm/peer.rs
parentb77f2ce13ec3dc3aff2495b93ca51a3a622bafa8 (diff)
no heal during catch-up
Diffstat (limited to 'src/swarm/peer.rs')
-rw-r--r--src/swarm/peer.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/swarm/peer.rs b/src/swarm/peer.rs
index bc3eaf9..faa6f91 100644
--- a/src/swarm/peer.rs
+++ b/src/swarm/peer.rs
@@ -2,6 +2,7 @@
//! swarm-wide forget records, and dispatch of inbound messages.
use std::sync::Arc;
+use std::sync::atomic::Ordering;
use std::time::Duration;
use anyhow::{Context, Result, anyhow, bail};
@@ -168,7 +169,11 @@ async fn heal_if_diverged(
// message to a peer that already has everything gets no reply at all.)
peer_state.sync.reply_settled();
}
- peer_state.needs_heal(&local.heads, &remote.heads, &state.timing, Instant::now())
+ // While we catch up, we hold back sync with everyone but the source on purpose:
+ // differing heads and idle sync are expected then, not a reason to heal.
+ let catching_up = !state.initial_sync_done.load(Ordering::Acquire);
+ !catching_up
+ && peer_state.needs_heal(&local.heads, &remote.heads, &state.timing, Instant::now())
};
if heal {