properly jump out of connection loop on state changing errors
This commit is contained in:
parent
dcdf340a41
commit
83c3258dd7
|
@ -346,11 +346,10 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
if (!tlsFactoryVerifier.verifier.verify(account.getServer(), verifiedHostname, ((SSLSocket) localSocket).getSession())) {
|
if (!tlsFactoryVerifier.verifier.verify(account.getServer(), verifiedHostname, ((SSLSocket) localSocket).getSession())) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
||||||
if (!iterator.hasNext()) {
|
FileBackend.close(localSocket);
|
||||||
throw new StateChangingException(Account.State.TLS_ERROR);
|
throw new StateChangingException(Account.State.TLS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
localSocket.setSoTimeout(Config.SOCKET_TIMEOUT * 1000);
|
localSocket.setSoTimeout(Config.SOCKET_TIMEOUT * 1000);
|
||||||
if (startXmpp(localSocket)) {
|
if (startXmpp(localSocket)) {
|
||||||
localSocket.setSoTimeout(0); //reset to 0; once the connection is established we don’t want this
|
localSocket.setSoTimeout(0); //reset to 0; once the connection is established we don’t want this
|
||||||
|
@ -359,13 +358,13 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
break; // successfully connected to server that speaks xmpp
|
break; // successfully connected to server that speaks xmpp
|
||||||
} else {
|
} else {
|
||||||
localSocket.close();
|
FileBackend.close(localSocket);
|
||||||
if (!iterator.hasNext()) {
|
|
||||||
throw new StateChangingException(Account.State.STREAM_OPENING_ERROR);
|
throw new StateChangingException(Account.State.STREAM_OPENING_ERROR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (final StateChangingException e) {
|
} catch (final StateChangingException e) {
|
||||||
|
if (!iterator.hasNext()) {
|
||||||
throw e;
|
throw e;
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": thread was interrupted before beginning stream");
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": thread was interrupted before beginning stream");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue