From a244c4084f75e12d8c2f0ea729b3b9b4efc3327b Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 25 Sep 2025 02:05:18 +0200 Subject: [PATCH] Stop dropping partial BLE frames while assembling notifications --- bitchat/Services/BLEService.swift | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/bitchat/Services/BLEService.swift b/bitchat/Services/BLEService.swift index 6e4783bf..9910e5c6 100644 --- a/bitchat/Services/BLEService.swift +++ b/bitchat/Services/BLEService.swift @@ -72,15 +72,7 @@ struct NotificationStreamAssembler { } if buffer.count < frameLength { - SecureLogger.warning("⚠️ Incomplete BLE frame: have \(buffer.count)B need \(frameLength)B; scanning for next header", category: .session) - if let nextStart = buffer.dropFirst().firstIndex(where: { $0 == 1 || $0 == 2 }) { - let dropCount = buffer.distance(from: buffer.startIndex, to: nextStart) - if dropCount > 0 { - let removed = buffer.prefix(dropCount) - buffer.removeFirst(dropCount) - dropped.append(contentsOf: removed) - } - } + SecureLogger.debug("⌛ Waiting for remaining \(frameLength - buffer.count)B to complete BLE frame", category: .session) break }