From 7c9c903898fc15ef0b46973ddc05ee25926f3cfb Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 23 Oct 2026 20:36:25 +0200 Subject: record the cause that started a sync session --- src/swarm/sync.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/swarm/sync.rs') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 1335361..dc2e665 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -63,7 +63,8 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str, retry_delivery: bool }; if !retry_delivery { - if let Some(wait) = peer_state.sync.opening_wait(Instant::now()) { + let now = Instant::now(); + if let Some(wait) = peer_state.sync.opening_wait(now) { trace!( wait_ms = wait.as_millis(), "Leaving the opening sync message to the peer" @@ -76,6 +77,14 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str, retry_delivery: bool }); return Ok(()); } + if peer_state.sync.opening_overdue(now) { + debug!( + cause = ?peer_state.sync.cause, + reply_owed = peer_state.reply_owed, + likely = peer_state.sync.cause.missing_opening_hint(), + "The peer didn't open the sync within the grace period; opening ourselves" + ); + } } swarm_id.clone() -- cgit v1.3.1