From 787a5952794eb6927c7bc2244aa8fd8a403849c6 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 03:47:04 +0100 Subject: unify source reset --- src/swarm/source.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/swarm') 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 { -- cgit v1.3.1