Fix packet order of FIN from SHUT_WR
#3562
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Shadow assigns a priority to packets, and packets with a lower priority will be sent before other packets. Previously, shadow only assigned a priority to non-empty packets (here meaning containing a payload), and a priority of 0 to other packets. But this meant that empty packets like FIN (with a priority of 0) could be sent before other packets, even if the FIN had a higher sequence number. Shadow seems to have discarded these out-of-order FIN packets. See #3100 for an example.
This MR changes the legacy TCP code to always assign a non-zero priority if the packets has a sequence number, so that they won't be sent out of order. This (edit: partially; see #3100 (comment)) fixes (edit: <text to prevent github from closing the linked issue>) #3100, but there are still a lot of other shutdown-related bugs (see all the disabled tests in
src/test/socket/shutdown/test_shutdown.rs), soshutdown()still won't work 100% as expected.Related: #3558 (I think this MR fixes this shutdown issue as well, but it looks like there are still some other issues.)