Made sure unwrap is called for all NEED_UNWRAP handshake status

This commit is contained in:
Trustin Lee 2008-11-16 15:14:32 +00:00
parent dce019966e
commit 62ed58a2be

View File

@ -421,6 +421,7 @@ public class SslHandler extends FrameDecoder {
ByteBuffer outNetBuf = bufferPool.acquire(); ByteBuffer outNetBuf = bufferPool.acquire();
boolean success = true; boolean success = true;
boolean offered = false; boolean offered = false;
boolean needsUnwrap = false;
try { try {
loop: loop:
for (;;) { for (;;) {
@ -475,6 +476,7 @@ public class SslHandler extends FrameDecoder {
break loop; break loop;
} }
case NEED_UNWRAP: case NEED_UNWRAP:
needsUnwrap = true;
break loop; break loop;
case NEED_TASK: case NEED_TASK:
runDelegatedTasks(); runDelegatedTasks();
@ -527,6 +529,10 @@ public class SslHandler extends FrameDecoder {
} }
} }
if (needsUnwrap) {
unwrap(context, channel, ChannelBuffers.EMPTY_BUFFER, 0, 0);
}
if (future == null) { if (future == null) {
future = succeededFuture(channel); future = succeededFuture(channel);
} }
@ -587,8 +593,10 @@ public class SslHandler extends FrameDecoder {
case NEED_TASK: case NEED_TASK:
runDelegatedTasks(); runDelegatedTasks();
break; break;
case NOT_HANDSHAKING:
case NEED_UNWRAP: case NEED_UNWRAP:
unwrap(ctx, channel, ChannelBuffers.EMPTY_BUFFER, 0, 0);
break;
case NOT_HANDSHAKING:
case NEED_WRAP: case NEED_WRAP:
break; break;
default: default: