Skip to content

Commit

Permalink
check handle before shutdown in quic connection Dispose (#56047)
Browse files Browse the repository at this point in the history
* check handle before shutdown in quic connection Dispose

* add comment
  • Loading branch information
wfurt authored Jul 21, 2021
1 parent 5d4860a commit 577136c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,14 @@ private void Dispose(bool disposing)
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(_state, $"{TraceId()} Stream disposing {disposing}");

// If we haven't already shutdown gracefully (via a successful CloseAsync call), then force an abortive shutdown.
MsQuicApi.Api.ConnectionShutdownDelegate(
_state.Handle,
QUIC_CONNECTION_SHUTDOWN_FLAGS.SILENT,
0);
if (_state.Handle != null)
{
// Handle can be null if outbound constructor failed and we are called from finalizer.
MsQuicApi.Api.ConnectionShutdownDelegate(
_state.Handle,
QUIC_CONNECTION_SHUTDOWN_FLAGS.SILENT,
0);
}

bool releaseHandles = false;
lock (_state)
Expand Down

0 comments on commit 577136c

Please sign in to comment.