Another experimental fix for SslHandler closure issue on handshake failure
This commit is contained in:
parent
29d56ff975
commit
d01c7e05f9
@ -439,14 +439,10 @@ public class SslHandler extends FrameDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer outAppBuf = pendingWrite.outAppBuf;
|
ByteBuffer outAppBuf = pendingWrite.outAppBuf;
|
||||||
boolean outboundDone;
|
|
||||||
SSLEngineResult result = null;
|
SSLEngineResult result = null;
|
||||||
try {
|
try {
|
||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
outboundDone = engine.isOutboundDone();
|
result = engine.wrap(outAppBuf, outNetBuf);
|
||||||
if (!outboundDone) {
|
|
||||||
result = engine.wrap(outAppBuf, outNetBuf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (!outAppBuf.hasRemaining()) {
|
if (!outAppBuf.hasRemaining()) {
|
||||||
@ -454,10 +450,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outboundDone) {
|
if (result.bytesProduced() > 0) {
|
||||||
success = false;
|
|
||||||
break;
|
|
||||||
} else if (result.bytesProduced() > 0) {
|
|
||||||
outNetBuf.flip();
|
outNetBuf.flip();
|
||||||
msg = ChannelBuffers.buffer(outNetBuf.remaining());
|
msg = ChannelBuffers.buffer(outNetBuf.remaining());
|
||||||
msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
|
msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
|
||||||
@ -652,14 +645,8 @@ public class SslHandler extends FrameDecoder {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
SSLEngineResult result;
|
SSLEngineResult result;
|
||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
|
|
||||||
boolean inboundDone = engine.isInboundDone();
|
|
||||||
if (inboundDone) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initialHandshake && !engine.getUseClientMode() &&
|
if (initialHandshake && !engine.getUseClientMode() &&
|
||||||
!inboundDone && !engine.isOutboundDone()) {
|
!engine.isInboundDone() && !engine.isOutboundDone()) {
|
||||||
handshake(channel);
|
handshake(channel);
|
||||||
initialHandshake = false;
|
initialHandshake = false;
|
||||||
}
|
}
|
||||||
@ -672,7 +659,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
|
|
||||||
switch (result.getHandshakeStatus()) {
|
switch (result.getHandshakeStatus()) {
|
||||||
case NEED_UNWRAP:
|
case NEED_UNWRAP:
|
||||||
if (inNetBuf.hasRemaining()) {
|
if (inNetBuf.hasRemaining() && !engine.isInboundDone()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
break loop;
|
break loop;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user