mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 02:05:19 +00:00
[codex] Refactor BLE transport event handling (#1266)
* Refactor BLE transport event handling * Make image output paths unique * Keep queued Nostr read receipts alive * Allow self-authored RSR ingress replies --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -97,6 +97,27 @@ struct NotificationStreamAssemblerTests {
|
||||
#expect(decoded.timestamp == packet.timestamp)
|
||||
}
|
||||
|
||||
@Test func discardsPKCSPaddingBetweenNotificationFrames() throws {
|
||||
var assembler = NotificationStreamAssembler()
|
||||
let packet1 = makePacket(timestamp: 0x111)
|
||||
let packet2 = makePacket(timestamp: 0x222)
|
||||
let paddedFrame1 = try #require(packet1.toBinaryData(padding: true), "Failed to encode first padded packet")
|
||||
let paddedFrame2 = try #require(packet2.toBinaryData(padding: true), "Failed to encode second padded packet")
|
||||
|
||||
var result = assembler.append(paddedFrame1)
|
||||
#expect(result.frames.count == 1)
|
||||
#expect(result.droppedPrefixes.isEmpty)
|
||||
#expect(result.reset == false)
|
||||
|
||||
result = assembler.append(paddedFrame2)
|
||||
#expect(result.frames.count == 1)
|
||||
#expect(result.droppedPrefixes.isEmpty)
|
||||
#expect(result.reset == false)
|
||||
|
||||
let decoded = try #require(BinaryProtocol.decode(result.frames[0]), "Failed to decode second frame")
|
||||
#expect(decoded.timestamp == packet2.timestamp)
|
||||
}
|
||||
|
||||
func testAssemblesCompressedLargeFrame() throws {
|
||||
var assembler = NotificationStreamAssembler()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user