Closed bernardnormier closed 1 year ago
While we can probably improve the code, I don't think DisposeAsync can wait for _streamsClosed to complete before disposing the underlying connection.
Example: an invocation got a response with a stream, and the application code is slowly reading this PipeReader (or doing other stuff while it's supposed to read the PipeReader). This payload/PipeReader corresponds to the stream Input and there is no way to speed-up its completion (stream.ReadsClosed) other than disposing the underlying connection. Am I missing something?
As a follow up to #3134, it would be make sense to refactor IceRpcProtocolConnection so that DisposeAsync waits for
_streamsClosed
before disposing its transport connection._streamsClosed is completed when _shutdownTask is not null and _streamCount is 0.
If we do that, InvokeAsync cannot be "killed" by an ODE, since DisposeAsync waits for the stream closure. This makes InvokeAsync a bit simpler as a result.
Currently (before #3134), we can't do that because a Slic stream write can hang forever (until the Slic connection is disposed).