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:47:31 +0200
commit4a788a5901e2613a028cc73e33e10cd67d092018 (patch)
treee20c35c2cdf027531b99c9ccdb1d9a0a935af44a /src/swarm/sync.rs
parentd35bf6f4211158491f1560f688202e1661a7c4ee (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 => {