Skip to content


Throw OperationCanceledException with correct CancellationToken durin…
Browse files Browse the repository at this point in the history
…g QuicConnection cancellation (#95459)
  • Loading branch information
rzikm committed Nov 30, 2023
1 parent 3805c17 commit ffbe1db
Showing 1 changed file with 5 additions and 3 deletions.
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

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

0 comments on commit ffbe1db

Please sign in to comment.