mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 12:49:35 -10:00
This fixes two issues in our managed ClientWebSocket implementation, both of which stemmed from a misunderstanding on my part of how things were supposed to work (or not work):
- I thought that if the WebSocket was already in a CloseSent state and then received a close frame that it should transition to Closed. Instead, it's supposed to transition to CloseReceived. Similarly, I thought a WebSocket that was already in a CloseReceived state and then sent a close frame was supposed to transition to Closed. Instead, it's supposed to transition to CloseSent. The WebSocket is only supposed to transition to Closed when the connection is closed.
- I thought that ReceiveAsync could only be used concurrently with a SendAsync. Turns out we need to support it being used concurrently with a Close{Output}Async.
This commit fixes both.
Commit migrated from https://github.com/dotnet/corefx/commit/b729fffc30a36fb765a149596d518658ea069938