h3: clear streams when send finishes before recv #2191
+180
−4
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.
h3 streams are meant to be dopped from the internal stream map when both the send and recv side of the stream are finished (this means both sending and received a
finfor example).However currently this only works if the recv side is finished first, and the clean-up happens on the next
send_body()orsend_response()call. When the opposite happens (e.g.finis sent before receiving it) the the stream leaks.This change adds logic to properly check for a stream being completed in that case as well, which involves tracking a "local finished" state for each stream.
When returning a
Finishedevent, the corresponding stream is checked again and if its send-side is also finished then the stream's state is cleared.Note that this change doesn't cover the case of stream being reset by the local application itself, as the h3 layer doesn't get any signal about that happening right now, so it will need follow-up changes to be fixed.