From 12fae75f850c3ca63a68378b2684b5d89f667e10 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 15:59:35 +0100 Subject: offer answers --- src/swarm/sync.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/swarm') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index e551cb8..0edc277 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -487,6 +487,17 @@ pub(crate) async fn handle_sync( ) } transport::SyncBody::Delta(spec) => { + // An offer answers what we sent as much as a message would: the wait for an + // answer ends here, not when the download does (its reply timeout would + // otherwise count against a peer that answered, suspect its path and give it + // up as the source to catch up from). What it offers is what it has. + { + let mut peer_state = peer_state_mutex.lock().await; + peer_state.reports_ready = Some(from_ready); + peer_state.last_heads = Some((epoch, transport::HeadsSummary::of(spec.to.clone()))); + peer_state.last_sync_rx = Some(Instant::now()); + peer_state.sync.answered_by_offer(); + } fetch_delta(state, peer, epoch, spec); return Ok(()); } -- cgit v1.3.1