Skip to content

Commit 0653732

Browse files
committed
SSLProcessor: Fix for possible infinite loop
If the only (or all of) the nio threads are in this loop, they may not recognize a remote connection close So the break here may not function without also checking the status of the ssl wrap. The existing client close check is still needed in order to detect local closes
1 parent abc4505 commit 0653732

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
group = org.threadly
2-
version = 4.6
3-
threadlyVersion = 5.25
2+
version = 4.7
3+
threadlyVersion = 5.27

src/main/java/org/threadly/litesockets/utils/SSLProcessor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ public MergedByteBuffers encrypt(final MergedByteBuffers lmbb) throws Encryption
149149
}
150150
if(!finishedHandshake.get() && res.getHandshakeStatus() == FINISHED) {
151151
gotFinished = true;
152+
} else if (res.getStatus() == SSLEngineResult.Status.CLOSED) {
153+
throw new EncryptionException("got ssl close_notify closing connection");
152154
} else {
153155
while (ssle.getHandshakeStatus() == NEED_TASK) {
154156
runTasks();
@@ -265,10 +267,14 @@ private void processHandshake(final HandshakeStatus status) throws SSLException
265267
*
266268
*/
267269
public static class EncryptionException extends Exception {
268-
269270
private static final long serialVersionUID = -2713992763314654069L;
271+
270272
public EncryptionException(final Throwable t) {
271273
super(t);
272274
}
275+
276+
public EncryptionException(String msg) {
277+
super(msg);
278+
}
273279
}
274280
}

0 commit comments

Comments
 (0)