Finish multiplexer's inbound streams in more cases (#483)

## Motivation
Currently, the multiplexer's inbound streams stream is finished only
when the channel becomes inactive.
There are some scenarios in which the channel may be closed before it
has a chance to become active, and the stream will never be finished.
This can cause any users iterating over the stream to hang.

## Modifications
This PR finishes the inbound streams stream when a connection error is
fired, and when the handler is removed.

## Result
Fewer bugs.
This commit is contained in:
Gus Cairo authored and GitHub committed 2024-11-15 10:45:47 +00:00
1 parent bb19976697
commit 1879e72392
5 files changed
+103

No files matched your search

@@ -213,6 +213,14 @@ extension HTTP2CommonInboundStreamMultiplexer {
self.streamChannelContinuation?.finish()
}
internal func propagateErrorCaught(_ error: any Error) {
self.streamChannelContinuation?.finish(throwing: error)
}
internal func propagateHandlerRemoved() {
self.streamChannelContinuation?.finish()
}
internal func selectivelyPropagateUserInboundEvent(context: ChannelHandlerContext, event: Any) {
func propagateEvent(_ event: Any) {
for channel in self.streams.values {