diff options
Diffstat (limited to 'src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs')
-rw-r--r-- | src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs index f0f75556921..1188efdcb9a 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicListenerHandle.cs @@ -1,23 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Runtime.InteropServices; +using Microsoft.Quic; namespace System.Net.Quic.Implementations.MsQuic.Internal { - internal sealed class SafeMsQuicListenerHandle : SafeHandle + internal sealed class SafeMsQuicListenerHandle : MsQuicSafeHandle { - public override bool IsInvalid => handle == IntPtr.Zero; - - public SafeMsQuicListenerHandle() - : base(IntPtr.Zero, ownsHandle: true) + public unsafe SafeMsQuicListenerHandle(QUIC_HANDLE* handle) + : base(handle, ptr => MsQuicApi.Api.ApiTable->ListenerClose((QUIC_HANDLE*)ptr), SafeHandleType.Listener) { } - - protected override bool ReleaseHandle() - { - MsQuicApi.Api.ListenerCloseDelegate(handle); - SetHandle(IntPtr.Zero); - return true; - } } } |