1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-09 20:42:44 +03:00

Add new retransmission buffer directly at the end of buffer list

Summary:
The retransmission buffer list is sorted by offset. New written
always has higher offset than existing ones. Thus the binary search isn't
necessary.

Reviewed By: mjoras

Differential Revision: D17477354

fbshipit-source-id: d413a5c84c3831b257d5c1e6375bec56a763926b
This commit is contained in:
Yang Chi
2019-09-24 15:14:05 -07:00
committed by Facebook Github Bot
parent 6f49898bf9
commit f5ca7ef590
4 changed files with 129 additions and 10 deletions

View File

@@ -98,16 +98,11 @@ void handleNewStreamDataWritten(
stream.currentWriteOffset += frameLen;
auto bufWritten = stream.writeBuffer.split(folly::to<size_t>(frameLen));
stream.currentWriteOffset += frameFin ? 1 : 0;
auto insertIt = std::upper_bound(
stream.retransmissionBuffer.begin(),
stream.retransmissionBuffer.end(),
originalOffset,
[](const auto& offset, const auto& compare) {
// TODO: huh? why isn't this a >= ?
return compare.offset > offset;
});
stream.retransmissionBuffer.emplace(
insertIt, std::move(bufWritten), originalOffset, frameFin);
CHECK(
stream.retransmissionBuffer.empty() ||
stream.retransmissionBuffer.back().offset < originalOffset);
stream.retransmissionBuffer.emplace_back(
std::move(bufWritten), originalOffset, frameFin);
}
void handleRetransmissionWritten(