From 52939e2c27b9ce5de318366d770f8f0a827fdd21 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 23 Oct 2026 23:15:59 +0200 Subject: no heal during catch-up --- src/swarm/peer.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/swarm') 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 { -- cgit v1.3.1