BLE: avoid self-message drop warnings by pre-marking own public broadcasts in dedup and ignoring self-origin public packets

This commit is contained in:
jack
2025-08-20 11:37:47 +02:00
parent b09710a7aa
commit eb16d128f2
+6
View File
@@ -529,6 +529,10 @@ final class BLEService: NSObject {
senderID: self.myPeerID, senderID: self.myPeerID,
payload: Data(content.utf8) payload: Data(content.utf8)
) )
// Pre-mark our own broadcast as processed to avoid handling relayed self copy
let senderHex = packet.senderID.hexEncodedString()
let dedupID = "\(senderHex)-\(packet.timestamp)-\(packet.type)"
self.messageDeduplicator.markProcessed(dedupID)
// Call synchronously since we're already on background queue // Call synchronously since we're already on background queue
self.broadcastPacket(packet) self.broadcastPacket(packet)
} }
@@ -1181,6 +1185,8 @@ final class BLEService: NSObject {
// Mention parsing moved to ChatViewModel // Mention parsing moved to ChatViewModel
private func handleMessage(_ packet: BitchatPacket, from peerID: String) { private func handleMessage(_ packet: BitchatPacket, from peerID: String) {
// Ignore self-origin public messages that may be seen again via relay
if peerID == myPeerID { return }
// Enforce: only accept public messages from verified peers we know // Enforce: only accept public messages from verified peers we know
guard let info = peers[peerID], info.isVerifiedNickname else { guard let info = peers[peerID], info.isVerifiedNickname else {