impl / libcurvecpr

A portable implementation of CurveCP
40 stars 10 forks source link

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

Open kostko opened 10 years ago

kostko commented 10 years ago

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:

This wrong behavior causes two issues:

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_;