Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Bugfix: fixed packet merger
  • Loading branch information
philips77 committed Sep 11, 2024
commit 88e832df579b9392e18dd0f795e0cfa58de9f8eb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class PacketMerger : DataMerger {
if (lastPacket == null)
return false

if (index == 0) {
receivedDataSize = 0
}

val buffer = ByteBuffer.wrap(lastPacket)
receivedDataSize += buffer.remaining()

Expand All @@ -33,7 +37,7 @@ class PacketMerger : DataMerger {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
return receivedDataSize - 2 == expectedSize
return receivedDataSize - 2 >= expectedSize
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class HeaderBasedPacketMerger: DataMerger {
if (lastPacket == null)
return false

if (index == 0) {
receivedDataSize = 0
}

val buffer = ByteBuffer.wrap(lastPacket)
receivedDataSize += buffer.remaining()

Expand All @@ -33,7 +37,7 @@ class HeaderBasedPacketMerger: DataMerger {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
return receivedDataSize - 2 == expectedSize
return receivedDataSize - 2 >= expectedSize
}

}