introduced error code for server not opening stream after auth or starttls

This commit is contained in:
Daniel Gultsch 2018-09-27 17:39:49 +02:00
parent cf879dd8e8
commit 9816261569
3 changed files with 647 additions and 643 deletions

File diff suppressed because it is too large Load Diff

View File

@ -398,6 +398,9 @@ 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(); localSocket.close();
if (!iterator.hasNext()) {
throw new StateChangingException(Account.State.STREAM_OPENING_ERROR);
}
} }
} catch (final StateChangingException e) { } catch (final StateChangingException e) {
throw e; throw e;
@ -520,7 +523,7 @@ public class XmppConnection implements Runnable {
if (tag != null && tag.isStart("stream")) { if (tag != null && tag.isStart("stream")) {
processStream(); processStream();
} else { } else {
throw new IOException("server didn't restart stream after successful auth"); throw new StateChangingException(Account.State.STREAM_OPENING_ERROR);
} }
break; break;
} else if (nextTag.isStart("failure")) { } else if (nextTag.isStart("failure")) {
@ -860,7 +863,7 @@ public class XmppConnection implements Runnable {
SSLSocketHelper.log(account, sslSocket); SSLSocketHelper.log(account, sslSocket);
processStream(); processStream();
} else { } else {
throw new IOException("server didn't restart stream after STARTTLS"); throw new StateChangingException(Account.State.STREAM_OPENING_ERROR);
} }
sslSocket.close(); sslSocket.close();
} catch (final NoSuchAlgorithmException | KeyManagementException e1) { } catch (final NoSuchAlgorithmException | KeyManagementException e1) {

View File

@ -152,6 +152,7 @@
<string name="account_status_policy_violation">Policy violation</string> <string name="account_status_policy_violation">Policy violation</string>
<string name="account_status_incompatible_server">Incompatible server</string> <string name="account_status_incompatible_server">Incompatible server</string>
<string name="account_status_stream_error">Stream error</string> <string name="account_status_stream_error">Stream error</string>
<string name="account_status_stream_opening_error">Stream opening error</string>
<string name="encryption_choice_unencrypted">Unencrypted</string> <string name="encryption_choice_unencrypted">Unencrypted</string>
<string name="encryption_choice_otr">OTR</string> <string name="encryption_choice_otr">OTR</string>
<string name="encryption_choice_pgp">OpenPGP</string> <string name="encryption_choice_pgp">OpenPGP</string>