-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The messager variable their_contiguous_sent_bytes, tracking the number of contiguous bytes that have been successfully received is not updated correctly when packets are reordered.
Imagine the following scenario:
- Currently bytes 0 - 12480 have been successfully received, ACKed (
their_contiguous_sent_bytes = 12480) and distributed (removed from the receive queue). - Because of packet reordering, block 14528 - 15552 is received next and is SACKed and marked as acknowledged in the receive queue. Since some blocks in front of it are missing, the block is not yet distributed.
- Blocks 12480 - 14528 are received next and are SACKed. Bytes 12480 - 15552 are distributed and removed from the receive queue. The first acknowledgement range now covers bytes 0 - 14528 and
their_contiguous_sent_bytesis updated to 14528. At this point, this sent bytes counter is stuck at this value and will never be incremented again.
This wrong behavior causes two issues:
- Selective ACKs will be unnecessarily fragmented as one SACK range will always cover 0 - 14528 (due to
their_contiguous_sent_bytesbeing stuck at 14528). - EOF will not be handled correctly, as messager will assume that some bytes still need to be received.
A workaround that I currently use in my Boost.ASIO C++ bindings is that when bytes are distributed, I update the their_contiguous_sent_bytes counter as follows:
// Update the number of contiguous sent bytes
if (messager_.their_contiguous_sent_bytes < recvmarkq_distributed_)
messager_.their_contiguous_sent_bytes = recvmarkq_distributed_;Metadata
Metadata
Assignees
Labels
No labels