Skip to content

Commit b3bcaf7

Browse files
committed
translate empty incoming buffer to empty outgoing buffer
1 parent 6bb2099 commit b3bcaf7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/DotNetty.Handlers/Tls/TlsHandler.Writer.cs

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ namespace DotNetty.Handlers.Tls
3838

3939
partial class TlsHandler
4040
{
41+
static readonly byte[] ZeroBuf = new byte[0];
42+
4143
private IPromise _lastContextWritePromise;
4244
private volatile int v_wrapDataSize = TlsUtils.MAX_PLAINTEXT_LENGTH;
4345

@@ -169,6 +171,14 @@ private void Wrap(IChannelHandlerContext context)
169171
}
170172
_lastContextWritePromise = promise;
171173
_ = buf.ReadBytes(_sslStream, readableBytes); // this leads to FinishWrap being called 0+ times
174+
if (buf.IsReadable())
175+
{
176+
_ = buf.ReadBytes(_sslStream, readableBytes); // this leads to FinishWrap being called 0+ times
177+
}
178+
else if (promise != null)
179+
{
180+
FinishWrap(ZeroBuf, 0, 0, promise);
181+
}
172182
}
173183
catch (Exception exc)
174184
{

0 commit comments

Comments
 (0)