Additional synchronization condition to avoid 'missing algorithm' error
This commit is contained in:
parent
0e3679e919
commit
d0964a4b46
@ -124,6 +124,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
private final boolean startTls;
|
private final boolean startTls;
|
||||||
|
|
||||||
final Object handshakeLock = new Object();
|
final Object handshakeLock = new Object();
|
||||||
|
private volatile boolean needsFirstHandshake = true;
|
||||||
private volatile boolean handshaking;
|
private volatile boolean handshaking;
|
||||||
private volatile boolean handshaken;
|
private volatile boolean handshaken;
|
||||||
private volatile ChannelFuture handshakeFuture;
|
private volatile ChannelFuture handshakeFuture;
|
||||||
@ -567,7 +568,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
SSLEngineResult result;
|
SSLEngineResult result;
|
||||||
try {
|
try {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (handshaking) {
|
if (handshaking || needsFirstHandshake) {
|
||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
result = engine.wrap(EMPTY_BUFFER, outNetBuf);
|
result = engine.wrap(EMPTY_BUFFER, outNetBuf);
|
||||||
}
|
}
|
||||||
@ -632,7 +633,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
loop:
|
loop:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
SSLEngineResult result;
|
SSLEngineResult result;
|
||||||
if (handshaking) {
|
if (handshaking || needsFirstHandshake) {
|
||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
result = engine.unwrap(inNetBuf, outAppBuf);
|
result = engine.unwrap(inNetBuf, outAppBuf);
|
||||||
}
|
}
|
||||||
@ -704,6 +705,7 @@ public class SslHandler extends FrameDecoder {
|
|||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
handshaking = false;
|
handshaking = false;
|
||||||
handshaken = true;
|
handshaken = true;
|
||||||
|
needsFirstHandshake = false; // Will not set to true again
|
||||||
|
|
||||||
if (handshakeFuture == null) {
|
if (handshakeFuture == null) {
|
||||||
handshakeFuture = newHandshakeFuture(channel);
|
handshakeFuture = newHandshakeFuture(channel);
|
||||||
|
Loading…
Reference in New Issue
Block a user