Skip to content

Commit

Permalink
Revert work-around for issue #392
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubb committed Oct 28, 2020
1 parent 45b16e6 commit b8cf3b0
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ public ServerConnection connect(Configuration config, SocketAddress address, Ser

SSLMode sslMode = config.getSetting(SSL_MODE);

return connect(config, sslMode, address, listener, 1);
return connect(config, sslMode, address, listener);
}

private ServerConnection connect(Configuration config, SSLMode sslMode, SocketAddress address, ServerConnection.Listener listener, int attempt) throws IOException {
private ServerConnection connect(Configuration config, SSLMode sslMode, SocketAddress address, ServerConnection.Listener listener) throws IOException {

try {

Expand Down Expand Up @@ -180,7 +180,7 @@ private ServerConnection connect(Configuration config, SSLMode sslMode, SocketAd

// Retry with no SSL
if (sslMode == SSLMode.Prefer) {
return connect(config, SSLMode.Disable, address, listener, attempt);
return connect(config, SSLMode.Disable, address, listener);
}

throw e;
Expand Down Expand Up @@ -230,16 +230,12 @@ else if (sslMode.isRequired()) {

switch (sslMode) {
case Allow:
return connect(config, SSLMode.Require, address, listener, attempt);
return connect(config, SSLMode.Require, address, listener);

case Prefer:
return connect(config, SSLMode.Disable, address, listener, attempt);
return connect(config, SSLMode.Disable, address, listener);

default:
// WORKAROUND: ISSUE#392: Retrying random startup disconnect mitigates failures.
if (e instanceof ClosedChannelException && attempt < 2) {
return connect(config, sslMode, address, listener, attempt + 1);
}
throw e;
}

Expand Down

0 comments on commit b8cf3b0

Please sign in to comment.