diff --git a/core/src/main/java/io/undertow/protocols/ssl/SslConduit.java b/core/src/main/java/io/undertow/protocols/ssl/SslConduit.java index c627256c01..398831608d 100644 --- a/core/src/main/java/io/undertow/protocols/ssl/SslConduit.java +++ b/core/src/main/java/io/undertow/protocols/ssl/SslConduit.java @@ -122,6 +122,7 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit { private static final int FLAG_CLOSED = 1 << 12; private static final int FLAG_WRITE_CLOSED = 1 << 13; private static final int FLAG_READ_CLOSED = 1 << 14; + public static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0); /** @@ -1142,14 +1143,13 @@ public void run() { task.run(); } finally { synchronized (SslConduit.this) { - if (outstandingTasks == 1) { + if (outstandingTasks-- == 1) { getWriteThread().execute(new Runnable() { @Override public void run() { synchronized (SslConduit.this) { SslConduit.this.notifyAll(); - --outstandingTasks; try { doHandshake(); } catch (IOException | RuntimeException | Error e) { @@ -1165,8 +1165,6 @@ public void run() { } } }); - } else { - outstandingTasks--; } } }