Skip to content
Merged
Changes from all commits
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
Code optimization
  • Loading branch information
philips77 committed Sep 11, 2024
commit b14413016d2c4e20b0ad8bcd3f40f5602d75a43a
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,10 @@ class HeaderBasedPacketMerger: DataMerger {
if (index == 0) {
expectedSize = buffer.short.toInt()
}
if ((receivedDataSize-2) == expectedSize) {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
.let { return true }
} else {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
.let { return false }
}
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
return receivedDataSize - 2 == expectedSize
}

}