// 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;
_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,
(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
{