aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/source.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 03:47:04 +0100
committertv <tv@krebsco.de>2026-10-31 03:47:04 +0100
commit32f733d834a82538786388e00fec22016a25e0e5 (patch)
tree51f1ec11c609267c15d1d64f62d1fd661eed86c5 /src/swarm/source.rs
parentc5f18c52a92dda6a94b950b54bf77b109694a894 (diff)
unify source reset
Diffstat (limited to 'src/swarm/source.rs')
-rw-r--r--src/swarm/source.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/swarm/source.rs b/src/swarm/source.rs
index d80e4d7..5e428f2 100644
--- a/src/swarm/source.rs
+++ b/src/swarm/source.rs
@@ -286,12 +286,18 @@ pub(crate) fn probe_due(state: &AppState, peer: &str, now: Instant) -> bool {
due
}
-/// The initial sync is done: no source any more, and the peers we held back only need
-/// to learn our heads now.
-pub(crate) fn finished(state: &AppState, from: &str) {
+/// No catch-up going on: no source, no head start, nobody avoided. When one ends, and
+/// before one starts (a rejoin: `Host::reset_initial_sync`).
+pub(crate) fn reset(state: &AppState) {
*lock(state) = None;
*lock_preference(state) = None;
*lock_avoided(state) = None;
+}
+
+/// The initial sync is done: no source any more, and the peers we held back only need
+/// to learn our heads now.
+pub(crate) fn finished(state: &AppState, from: &str) {
+ reset(state);
let state = state.clone();
let from = from.to_owned();
tokio::spawn(async move {