internal void CheckThrow(bool authSuccessCheck, bool shutdownCheck = false) { if (_exception != null) { _exception.Throw(); } if (authSuccessCheck && !IsAuthenticated) { throw new InvalidOperationException(SR.net_auth_noauth); } if (shutdownCheck && _shutdown) { throw new InvalidOperationException(SR.net_ssl_io_already_shutdown); } }
private ValueTask WriteAsyncInternal <TWriteAdapter>(TWriteAdapter writeAdapter, ReadOnlyMemory <byte> buffer) where TWriteAdapter : struct, ISslWriteAdapter { _sslState.CheckThrow(authSuccessCheck: true, shutdownCheck: true); if (buffer.Length == 0 && !SslStreamPal.CanEncryptEmptyMessage) { // If it's an empty message and the PAL doesn't support that, we're done. return(default);