Skip to content

Commit

Permalink
[UNDERTOW-2304] Prevent repeating SslConduit.doUnwrap under task thre…
Browse files Browse the repository at this point in the history
…ad exhaustion conditions

Signed-off-by: Flavia Rainone <frainone@redhat.com>
  • Loading branch information
fl4via committed Sep 26, 2023
1 parent 58f43f0 commit 23a6a6d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/src/main/java/io/undertow/protocols/ssl/SslConduit.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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) {
Expand All @@ -1165,8 +1165,6 @@ public void run() {
}
}
});
} else {
outstandingTasks--;
}
}
}
Expand Down

0 comments on commit 23a6a6d

Please sign in to comment.