From eccec2f27df4730665a87840ac83863d8f306e88 Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 25 Sep 2025 02:03:24 +0200 Subject: [PATCH] Log incomplete BLE frames for debugging --- bitchat/Services/BLEService.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitchat/Services/BLEService.swift b/bitchat/Services/BLEService.swift index 5aa9c4f5..6e4783bf 100644 --- a/bitchat/Services/BLEService.swift +++ b/bitchat/Services/BLEService.swift @@ -65,12 +65,14 @@ struct NotificationStreamAssembler { if hasSignature { frameLength += BinaryProtocol.signatureSize } guard frameLength > 0, frameLength <= maxFrameLength else { + SecureLogger.error("❌ Notification frame length \(frameLength) invalid (cap=\(maxFrameLength)); resetting stream", category: .session) buffer.removeAll() reset = true break } 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 {