fix: dedup filter collision between different senders + build scripts default --pull
- 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:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user