Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ internal static SafeSslHandle AllocateSslHandle(SslAuthenticationOptions sslAuth
if (cacheSslContext && !string.IsNullOrEmpty(punyCode))
{
sslCtxHandle.TrySetSession(sslHandle, punyCode);
bool ignored = false;
sslCtxHandle.DangerousAddRef(ref ignored);
sslHandle.SslContextHandle = sslCtxHandle;
}

// relevant to TLS 1.3 only: if user supplied a client cert or cert callback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ internal sealed class SafeSslHandle : SafeDeleteSslContext
private bool _handshakeCompleted;

public GCHandle AlpnHandle;
public SafeSslContextHandle? SslContextHandle;

public bool IsServer
{
Expand Down Expand Up @@ -432,6 +433,8 @@ protected override bool ReleaseHandle()
Disconnect();
}

SslContextHandle?.DangerousRelease();

IntPtr h = handle;
SetHandle(IntPtr.Zero);
Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
Expand Down