Skip to content

Commit

Permalink
SSLProcessor: Fix for possible infinite loop
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jentfoo committed Aug 21, 2018
1 parent abc4505 commit 0653732
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group = org.threadly
version = 4.6
threadlyVersion = 5.25
version = 4.7
threadlyVersion = 5.27
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public MergedByteBuffers encrypt(final MergedByteBuffers lmbb) throws Encryption
}
if(!finishedHandshake.get() && res.getHandshakeStatus() == FINISHED) {
gotFinished = true;
} else if (res.getStatus() == SSLEngineResult.Status.CLOSED) {
throw new EncryptionException("got ssl close_notify closing connection");
} else {
while (ssle.getHandshakeStatus() == NEED_TASK) {
runTasks();
Expand Down Expand Up @@ -265,10 +267,14 @@ private void processHandshake(final HandshakeStatus status) throws SSLException
*
*/
public static class EncryptionException extends Exception {

private static final long serialVersionUID = -2713992763314654069L;

public EncryptionException(final Throwable t) {
super(t);
}

public EncryptionException(String msg) {
super(msg);
}
}
}

0 comments on commit 0653732

Please sign in to comment.