Skip to content

Commit

Permalink
Fix potential Debug.Assert in QuicListener (#103965)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm committed Jun 26, 2024
1 parent 52a01c6 commit 2fab73c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ private async void StartConnectionHandshake(QuicConnection connection, SslClient
// https://github.com/microsoft/msquic/discussions/2705.
// This will be assigned to before the linked CTS is cancelled
TimeSpan handshakeTimeout = QuicDefaults.HandshakeTimeout;
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeCts.Token, connection.ConnectionShutdownToken);
try
{
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeCts.Token, connection.ConnectionShutdownToken);
cancellationToken = linkedCts.Token;
// Initial timeout for retrieving connection options.
linkedCts.CancelAfter(handshakeTimeout);
Expand All @@ -249,7 +249,7 @@ private async void StartConnectionHandshake(QuicConnection connection, SslClient
await connection.DisposeAsync().ConfigureAwait(false);
}
}
catch (OperationCanceledException) when (connection.ConnectionShutdownToken.IsCancellationRequested)
catch (OperationCanceledException) when (connection.ConnectionShutdownToken.IsCancellationRequested && !linkedCts.IsCancellationRequested)
{
// Connection closed by peer
if (NetEventSource.Log.IsEnabled())
Expand Down

0 comments on commit 2fab73c

Please sign in to comment.