Merge changes back from 3.2 branch which fixes a deadlock in the

SslHandler. See NETTY-443
This commit is contained in:
Norman Maurer 2011-10-25 19:58:21 +02:00
parent 2ae095f92c
commit a67e550207

View File

@ -871,14 +871,22 @@ public class SslHandler extends FrameDecoder
loop: loop:
for (;;) { for (;;) {
SSLEngineResult result; SSLEngineResult result;
boolean needsHandshake = false;
synchronized (handshakeLock) { synchronized (handshakeLock) {
if (!handshaken && !handshaking && if (!handshaken && !handshaking &&
!engine.getUseClientMode() && !engine.getUseClientMode() &&
!engine.isInboundDone() && !engine.isOutboundDone()) { !engine.isInboundDone() && !engine.isOutboundDone()) {
needsHandshake = true;
}
}
if (needsHandshake) {
handshake(); handshake();
} }
synchronized (handshakeLock) {
result = engine.unwrap(inNetBuf, outAppBuf); result = engine.unwrap(inNetBuf, outAppBuf);
}
final HandshakeStatus handshakeStatus = result.getHandshakeStatus(); final HandshakeStatus handshakeStatus = result.getHandshakeStatus();
handleRenegotiation(handshakeStatus); handleRenegotiation(handshakeStatus);
@ -906,7 +914,7 @@ public class SslHandler extends FrameDecoder
throw new IllegalStateException( throw new IllegalStateException(
"Unknown handshake status: " + handshakeStatus); "Unknown handshake status: " + handshakeStatus);
} }
}
} }
if (needsWrap) { if (needsWrap) {