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

Throw OperationCanceledException with correct CancellationToken during QuicConnection cancellation #95459

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ static async ValueTask<QuicConnection> StartConnectAsync(QuicClientConnectionOpt
{
await connection.FinishConnectAsync(options, linkedCts.Token).ConfigureAwait(false);
}
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
catch (OperationCanceledException)
{
// handshake timeout elapsed, tear down the connection.
// Note that since handshake is not done yet, application error code is not sent.
await connection.DisposeAsync().ConfigureAwait(false);

// throw OCE with correct token if cancellation requested by user
cancellationToken.ThrowIfCancellationRequested();

// cancellation by the linkedCts.CancelAfter. Convert to Timeout
throw new QuicException(QuicError.ConnectionTimeout, null, SR.Format(SR.net_quic_handshake_timeout, options.HandshakeTimeout));
}
catch
Expand Down
Loading