Skip to content

Fix WebSocket connection teardown throwing and leaving stale state - #1657

Merged
JustArchi merged 3 commits into
masterfrom
websocket-teardown
Nov 5, 2026
Merged

JustArchi merged 3 commits into
masterfrom
websocket-teardown

Conversation

@xPaw

@xPaw xPaw commented Nov 5, 2026

Copy link
Copy Markdown
Member

Fixes #1656.

  • WebSocketContext.Dispose no longer runs a close handshake. RunSynchronously on CloseAsync threw whenever the socket was open, so Disconnected was never raised and CMClient.IsConnected stayed true.
  • A stale context can no longer clear the current one, and a failed Send only disconnects the context it was sent on.
  • Handler exceptions no longer kill the read loop: a throwing Connected handler disconnects, a throwing NetMsgReceived handler is logged, as in TcpConnection.
  • Connect no longer throws when the handshake fails synchronously.
  • Adds in-memory WebSocket tests for WebSocketConnection and SteamClient.

@xPaw
xPaw requested a review from yaakov-h November 5, 2026 09:35
@xPaw
xPaw force-pushed the websocket-teardown branch from 7e72cf4 to 7c3b93d Compare November 5, 2026 10:04
@xPaw
xPaw force-pushed the websocket-teardown branch from 7c3b93d to dc71c29 Compare November 5, 2026 12:09

@JustArchi JustArchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JustArchi
JustArchi merged commit 271f378 into master Nov 5, 2026
17 checks passed
@JustArchi
JustArchi deleted the websocket-teardown branch November 5, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocketContext.Dispose() throws InvalidOperationException on teardown, leaving CMClient.IsConnected stuck true

3 participants