Skip to content

Commit

Permalink
Immediately fail if the SSL handshake fails
Browse files Browse the repository at this point in the history
  • Loading branch information
spark404 committed Nov 20, 2015
1 parent 9401bfa commit d9f3b68
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.concurrent.atomic.AtomicInteger;

import javax.net.SocketFactory;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSocketFactory;
import com.notnoop.apns.ApnsDelegate;
import com.notnoop.apns.StartSendingApnsDelegate;
Expand Down Expand Up @@ -334,6 +335,9 @@ private synchronized void sendMessage(ApnsNotification m, boolean fromBuffer) th
//logger.debug("Message \"{}\" sent", m);
attempts = 0;
break;
} catch (SSLHandshakeException e) {
// No use retrying this, it's dead Jim
throw new NetworkIOException(e);
} catch (IOException e) {
Utilities.close(socket);
if (attempts >= RETRIES) {
Expand Down

0 comments on commit d9f3b68

Please sign in to comment.