[QUIC] Notify quic streams on connection abort #52665
Closed
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.
Algorithm and thoughts:
The only one who knows the Connection was aborted is the Connection itself. Connection's SHUTDOWN_INITIATED_BY_PEER will be immediately followed by Stream's SHUTDOWN_COMPLETED -- which we treat as EndOfStream, hence the issue #32050. As soon as we get Connection's SHUTDOWN_INITIATED_BY_PEER, we want to notify all the Connection's Streams that the Connection was aborted, so the Streams would abort all outstanding operations with the correct exception, and throw on subsequent ones, and ignore Stream's SHUTDOWN_COMPLETED.
This can be done by maintaining a list of Streams inside Connection. There are two problems I see with that: allowing Streams be garbage collected and removing Streams from the list on Stream's Dispose and/or garbage collection.
The first one I solved with WeakReferences.
For the second one I see two possible solutions:
I'm opening that as I already have the working code, but I would be happy to hear other ideas.
Fixes #32050