Skip to content
Open
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
11 changes: 10 additions & 1 deletion src/DotNetty.Handlers/Tls/TlsHandler.Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace DotNetty.Handlers.Tls

partial class TlsHandler
{
static readonly byte[] ZeroBuf = new byte[0];

private IPromise _lastContextWritePromise;
private volatile int v_wrapDataSize = TlsUtils.MAX_PLAINTEXT_LENGTH;

Expand Down Expand Up @@ -168,7 +170,14 @@ private void Wrap(IChannelHandlerContext context)
composite.Release();
}
_lastContextWritePromise = promise;
_ = buf.ReadBytes(_sslStream, readableBytes); // this leads to FinishWrap being called 0+ times
if (buf.IsReadable())
{
_ = buf.ReadBytes(_sslStream, readableBytes); // this leads to FinishWrap being called 0+ times
}
else if (promise != null)
{
FinishWrap(ZeroBuf, 0, 0, promise);
}
}
catch (Exception exc)
{
Expand Down