From ef48adfc7c97e0ab37f0136e0588e890dfa60104 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Tue, 20 Jul 2021 10:20:51 -0700 Subject: [PATCH] remove unnecessary call (#55795) * remove unnecessary call * fix typo --- .../Net/Quic/Implementations/MsQuic/MsQuicConnection.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs index 39bd5e80f6c..ef881266891 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs @@ -27,7 +27,7 @@ namespace System.Net.Quic.Implementations.MsQuic // TODO: remove this. // This is only used for client-initiated connections, and isn't needed even then once Connect() has been called. - private readonly SafeMsQuicConfigurationHandle? _configuration; + private SafeMsQuicConfigurationHandle? _configuration; private readonly State _state = new State(); private int _disposed; @@ -188,9 +188,6 @@ namespace System.Net.Quic.Implementations.MsQuic _state.StateGCHandle = GCHandle.Alloc(_state); try { - // this handle is ref counted by MsQuic, so safe to dispose here. - using SafeMsQuicConfigurationHandle config = SafeMsQuicConfigurationHandle.Create(options); - uint status = MsQuicApi.Api.ConnectionOpenDelegate( MsQuicApi.Api.Registration, s_connectionDelegate, @@ -575,6 +572,10 @@ namespace System.Net.Quic.Implementations.MsQuic (ushort)port); QuicExceptionHelpers.ThrowIfFailed(status, "Failed to connect to peer."); + + // this handle is ref counted by MsQuic, so safe to dispose here. + _configuration.Dispose(); + _configuration = null; } catch { -- 2.34.1