From 2638df1a9269962685a4a058edbdf6c86e60535b Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 25 Oct 2026 22:46:51 +0100 Subject: avoid stalled source A source given up for not answering our sync messages could become the source again straight away. Whoever asks first after the reset takes the role, and that's often the same peer, which would then stall for another delivery limit. Now, a stalled source isn't chosen again for one more delivery_limit. If it's the only candidate, catching up waits that long and then tries it again. Before, a retry with that peer couldn't have helped any sooner anyway: a source is only given up after a whole delivery limit without a sync message, and that clock restarts when it is chosen again. --- src/state.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index 5ec1c5a..78b058c 100644 --- a/src/state.rs +++ b/src/state.rs @@ -673,6 +673,9 @@ pub(crate) struct AppState { pub(crate) catch_up_source: Arc>>, /// Since when a closer peer has had a head start to become the source. pub(crate) catch_up_preference: Arc>>, + /// A catch-up source given up for not answering our sync messages, and until when it + /// isn't chosen again (`swarm::source`). + pub(crate) catch_up_avoided: Arc>>, } /// The peer a catching-up node syncs with first (`swarm::source`). -- cgit v1.3.1