Fix regression introduced by 4c7fa950cc4f4c52eeaae5887335b1f3047592f8

- Some promises were not fulfilled when SSLEngine produces 0 bytes.
This commit is contained in:
Trustin Lee 2013-11-14 15:08:10 +09:00
parent 7231be592a
commit b65b4199dc

View File

@ -495,24 +495,21 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
} }
private void finishWrap(ChannelHandlerContext ctx, ByteBuf out, ChannelPromise promise, boolean inUnwrap) { private void finishWrap(ChannelHandlerContext ctx, ByteBuf out, ChannelPromise promise, boolean inUnwrap) {
if (out != null) { if (out == null) {
if (out.isReadable()) { out = Unpooled.EMPTY_BUFFER;
if (promise != null) { } else if (!out.isReadable()) {
ctx.write(out, promise); out.release();
} else { out = Unpooled.EMPTY_BUFFER;
ctx.write(out); }
}
if (inUnwrap) { if (promise != null) {
needsFlush = true; ctx.write(out, promise);
} } else {
} else { ctx.write(out);
out.release(); }
}
} else if (promise != null) { if (inUnwrap) {
ctx.write(Unpooled.EMPTY_BUFFER, promise); needsFlush = true;
if (inUnwrap) {
needsFlush = true;
}
} }
} }