diff options
| author | tv <tv@krebsco.de> | 2026-10-23 23:15:59 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-23 23:15:59 +0200 |
| commit | 3fc75c9a1a696778c44f4e2ebd0c0c763f40381c (patch) | |
| tree | eefbdc3388ece2fcf9eb43294f475b81049eb29d /src | |
| parent | f40b729d35bc85cebe43428d2ba37036cc96e36f (diff) | |
no heal during catch-up
Diffstat (limited to 'src')
| -rw-r--r-- | src/swarm/peer.rs | 7 |
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 { |
