Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] WS cancelation fix #99522

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Mar 11, 2024

Fixes #98201
Fixes #98145

@@ -135,9 +135,10 @@ private WebSocketState FastState

internal Task ConnectAsync(Uri uri, List<string>? requestedSubProtocols, CancellationToken cancellationToken)
{
AbortIfCancelationRequested(cancellationToken);
Copy link
Member

Choose a reason for hiding this comment

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

Why moving it out of the lock?

Copy link
Member Author

Choose a reason for hiding this comment

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

It probably doesn't matter

{
Abort();
} // lock
cancellationToken.ThrowIfCancellationRequested();
Copy link
Member

Choose a reason for hiding this comment

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

fyi: this internally checks for 'cancellationToken.IsCancellationRequested`.

pavelsavara and others added 2 commits March 12, 2024 08:30
…ockets/BrowserWebSockets/BrowserWebSocket.cs

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
@pavelsavara pavelsavara merged commit 19d7768 into dotnet:main Mar 12, 2024
119 checks passed
@pavelsavara pavelsavara deleted the browser_ws_cancelation branch March 12, 2024 13:57
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Projects
None yet
2 participants