summaryrefslogtreecommitdiffstats
path: root/src/swarm/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-23 22:47:31 +0200
committertv <tv@krebsco.de>2026-10-23 22:50:09 +0200
commit42b2b644815a2b7f29eb078eb515820368121f89 (patch)
treec6e3fc9f7669219d60695949a74b5e578a4e5fea /src/swarm/sync.rs
parentde560ee34ba0297194cae6ac9a1966e3ef614945 (diff)
drop pre-membership sync messages
The handshake resets the session anyway, and the sender's reply timeout resends what still matters.
Diffstat (limited to 'src/swarm/sync.rs')
-rw-r--r--src/swarm/sync.rs20
1 files changed, 4 insertions, 16 deletions
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 => {