Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contiguous sent bytes is not updated correctly under packet reordering #10

Open
kostko opened this issue May 19, 2014 · 0 comments
Open

Comments

@kostko
Copy link
Contributor

kostko commented May 19, 2014

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_bytes is 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_bytes being 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_;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant