summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {