fix: dedup filter collision between different senders + build scripts default --pull
Some checks failed
Mirror to GitHub / mirror (push) Failing after 35s
Build Release Binaries / build-amd64 (push) Failing after 1m53s

- Dedup key now includes source peer fingerprint hash, preventing
  packets from different senders with same room+seq from being dropped
  as duplicates (was silently killing all multi-hop audio)
- Build scripts default to --pull (use --no-pull to skip)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-08 15:18:52 +04:00
parent 2eab56beec
commit 8b79cdc6fc
3 changed files with 17 additions and 5 deletions

View File

@@ -55,8 +55,10 @@ impl Deduplicator {
} }
/// Returns true if this packet is a duplicate (already seen). /// Returns true if this packet is a duplicate (already seen).
fn is_dup(&mut self, room_hash: &[u8; 8], seq: u16) -> bool { /// The source_fp_hash distinguishes packets from different senders
let key = u64::from_be_bytes(*room_hash) ^ (seq as u64); /// that share the same room and seq number.
fn is_dup(&mut self, room_hash: &[u8; 8], seq: u16, source_fp_hash: u64) -> bool {
let key = u64::from_be_bytes(*room_hash) ^ (seq as u64) ^ source_fp_hash;
if self.seen.contains(&key) { if self.seen.contains(&key) {
return true; return true;
} }
@@ -850,9 +852,17 @@ async fn handle_datagram(
} }
// Dedup: drop packets we've already seen (multi-path duplicates) // Dedup: drop packets we've already seen (multi-path duplicates)
// Include source peer fingerprint so different senders with same seq aren't confused
let source_fp_hash = {
let mut h = 0u64;
for (i, b) in source_peer_fp.bytes().enumerate().take(8) {
h ^= (b as u64) << ((i % 8) * 8);
}
h
};
{ {
let mut dedup = fm.dedup.lock().await; let mut dedup = fm.dedup.lock().await;
if dedup.is_dup(&rh, pkt.header.seq) { if dedup.is_dup(&rh, pkt.header.seq, source_fp_hash) {
return; return;
} }
} }

View File

@@ -17,12 +17,13 @@ LOCAL_OUTPUT="target/android-apk"
SSH_OPTS="-o ConnectTimeout=15 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -o LogLevel=ERROR" SSH_OPTS="-o ConnectTimeout=15 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -o LogLevel=ERROR"
REBUILD_RUST=0 REBUILD_RUST=0
DO_PULL=0 DO_PULL=1
DO_INSTALL=0 DO_INSTALL=0
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--rust) REBUILD_RUST=1 ;; --rust) REBUILD_RUST=1 ;;
--pull) DO_PULL=1 ;; --pull) DO_PULL=1 ;;
--no-pull) DO_PULL=0 ;;
--install) DO_INSTALL=1 ;; --install) DO_INSTALL=1 ;;
esac esac
done done

View File

@@ -17,12 +17,13 @@ NTFY_TOPIC="https://ntfy.sh/wzp"
LOCAL_OUTPUT="target/linux-x86_64" LOCAL_OUTPUT="target/linux-x86_64"
SSH_OPTS="-o ConnectTimeout=15 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -o LogLevel=ERROR" SSH_OPTS="-o ConnectTimeout=15 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -o LogLevel=ERROR"
DO_PULL=0 DO_PULL=1
DO_CLEAN=0 DO_CLEAN=0
DO_INSTALL=0 DO_INSTALL=0
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--pull) DO_PULL=1 ;; --pull) DO_PULL=1 ;;
--no-pull) DO_PULL=0 ;;
--clean) DO_CLEAN=1 ;; --clean) DO_CLEAN=1 ;;
--install) DO_INSTALL=1 ;; --install) DO_INSTALL=1 ;;
esac esac