public ProtocolToken CreateShutdownToken()
{
if (NetEventSource.IsEnabled) NetEventSource.Enter(this);
SecurityStatusPal status;
status = SslStreamPal.ApplyShutdownToken(ref _credentialsHandle, _securityContext);
if (status.ErrorCode != SecurityStatusPalErrorCode.OK)
{
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"ApplyAlertToken() returned {status.ErrorCode}");
if (status.Exception != null)
{
throw status.Exception;
}
return null;
}
ProtocolToken token = GenerateAlertToken();
if (NetEventSource.IsEnabled) NetEventSource.Exit(this, token);
return token;
}