From 42b2b644815a2b7f29eb078eb515820368121f89 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 23 Oct 2026 22:47:31 +0200 Subject: drop pre-membership sync messages The handshake resets the session anyway, and the sender's reply timeout resends what still matters. --- src/swarm/sync.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/swarm/sync.rs') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 04a174c..04cb31c 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -274,25 +274,13 @@ pub(crate) async fn handle_sync( let peer_state_mutex = state.get_or_create_peer_state(peer).await; let needs_hello = { - let mut peer_state = peer_state_mutex.lock().await; + let peer_state = peer_state_mutex.lock().await; match &peer_state.standing { Standing::Stranger | Standing::Admitted => { - let duplicate = peer_state.pending_inbound_sync.iter().any(|pending| { - pending.message == envelope.message - && pending.swarm_id == envelope.swarm_id - && pending.epoch == envelope.epoch - }); - if !duplicate { - peer_state.pending_inbound_sync.push(envelope.clone()); - info!( - peer = %peer, - pending_count = peer_state.pending_inbound_sync.len(), - "Queued sync envelope pending peer membership" - ); - } else { - trace!(peer = %peer, "Ignoring duplicate pending sync envelope"); - } + // Not processed: our handshake reply resets the session anyway, and the + // sender's reply timeout resends what still matters. + debug!(peer = %peer, "Dropping sync message from a peer that isn't a member yet"); true } Standing::Member { swarm_id } if swarm_id != &envelope.swarm_id => { -- cgit v1.3.1