mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 12:25:19 +00:00
Stop dropping partial BLE frames while assembling notifications
This commit is contained in:
@@ -72,15 +72,7 @@ struct NotificationStreamAssembler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if buffer.count < frameLength {
|
if buffer.count < frameLength {
|
||||||
SecureLogger.warning("⚠️ Incomplete BLE frame: have \(buffer.count)B need \(frameLength)B; scanning for next header", category: .session)
|
SecureLogger.debug("⌛ Waiting for remaining \(frameLength - buffer.count)B to complete BLE frame", 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user