While making Halibut async, we found that a WebSocketStream does not support asynchronous disposal.
Results
Related to OctopusDeploy/Issues#8266
Before
WebSocketStream disposed synchronously, resulting in a call to the asynchronous context.CloseOutputAsync with a blocking .GetAwaiter().GetResult() at the end...
After
WebSocketStream now supports async disposal, and therefore calls context.CloseOutputAsync asynchronously.
As a result, when SecureConnection wraps a WebSocketStream, it can dispose of it asynchronously (which it already did, but would result in sync disposal before).
Using SecureConnection, the SecureWebSocketClient can now dispose of of the connection asynchronously (on async paths).
Also, SecureWebSocketListener can now dispose of the WebSocketStream asynchronously also.
How to review this PR
SecureWebSocketListener doesn't have a "sync vs async" path. So making it dispose WebSocketStream async is a different behaviour to the synchronous version.
I think it will be fine, but thought it worth raising in case we wish to split that out into a separate story.
Quality :heavy_check_mark:
Pre-requisites
[ ] I have read How we use GitHub Issues for help deciding when and where it's appropriate to make an issue.
[ ] I have considered informing or consulting the right people, according to the ownership map.
[ ] I have considered appropriate testing for my change.
[sc-57814]
Background
While making Halibut async, we found that a
WebSocketStream
does not support asynchronous disposal.Results
Related to OctopusDeploy/Issues#8266
Before
WebSocketStream
disposed synchronously, resulting in a call to the asynchronouscontext.CloseOutputAsync
with a blocking.GetAwaiter().GetResult()
at the end...After
WebSocketStream
now supports async disposal, and therefore callscontext.CloseOutputAsync
asynchronously.As a result, when
SecureConnection
wraps aWebSocketStream
, it can dispose of it asynchronously (which it already did, but would result in sync disposal before).Using
SecureConnection
, theSecureWebSocketClient
can now dispose of of the connection asynchronously (on async paths).Also,
SecureWebSocketListener
can now dispose of theWebSocketStream
asynchronously also.How to review this PR
SecureWebSocketListener
doesn't have a "sync vs async" path. So making it disposeWebSocketStream
async is a different behaviour to the synchronous version.I think it will be fine, but thought it worth raising in case we wish to split that out into a separate story.
Quality :heavy_check_mark:
Pre-requisites