mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 09:42:17 -05:00
no automatic reconnect on registration failures
This commit is contained in:
parent
d6193aa586
commit
097fe3e1b6
@ -109,45 +109,55 @@ public class Account extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
DISABLED,
|
DISABLED(false,false),
|
||||||
OFFLINE,
|
OFFLINE(false),
|
||||||
CONNECTING,
|
CONNECTING(false),
|
||||||
ONLINE,
|
ONLINE(false),
|
||||||
NO_INTERNET,
|
NO_INTERNET(false),
|
||||||
UNAUTHORIZED(true),
|
UNAUTHORIZED,
|
||||||
SERVER_NOT_FOUND(true),
|
SERVER_NOT_FOUND,
|
||||||
REGISTRATION_FAILED(true),
|
REGISTRATION_SUCCESSFUL(false),
|
||||||
REGISTRATION_WEB(true),
|
REGISTRATION_FAILED(true,false),
|
||||||
REGISTRATION_CONFLICT(true),
|
REGISTRATION_WEB(true,false),
|
||||||
REGISTRATION_SUCCESSFUL,
|
REGISTRATION_CONFLICT(true,false),
|
||||||
REGISTRATION_NOT_SUPPORTED(true),
|
REGISTRATION_NOT_SUPPORTED(true,false),
|
||||||
TLS_ERROR(true),
|
REGISTRATION_PLEASE_WAIT(true,false),
|
||||||
INCOMPATIBLE_SERVER(true),
|
REGISTRATION_PASSWORD_TOO_WEAK(true,false),
|
||||||
TOR_NOT_AVAILABLE(true),
|
TLS_ERROR,
|
||||||
DOWNGRADE_ATTACK(true),
|
INCOMPATIBLE_SERVER,
|
||||||
SESSION_FAILURE(true),
|
TOR_NOT_AVAILABLE,
|
||||||
BIND_FAILURE(true),
|
DOWNGRADE_ATTACK,
|
||||||
HOST_UNKNOWN(true),
|
SESSION_FAILURE,
|
||||||
REGISTRATION_PLEASE_WAIT(true),
|
BIND_FAILURE,
|
||||||
STREAM_ERROR(true),
|
HOST_UNKNOWN,
|
||||||
POLICY_VIOLATION(true),
|
STREAM_ERROR,
|
||||||
REGISTRATION_PASSWORD_TOO_WEAK(true),
|
POLICY_VIOLATION,
|
||||||
PAYMENT_REQUIRED(true),
|
PAYMENT_REQUIRED,
|
||||||
MISSING_INTERNET_PERMISSION(true),
|
MISSING_INTERNET_PERMISSION(false),
|
||||||
NETWORK_IS_UNREACHABLE(false);
|
NETWORK_IS_UNREACHABLE(false);
|
||||||
|
|
||||||
private final boolean isError;
|
private final boolean isError;
|
||||||
|
private final boolean attemptReconnect;
|
||||||
|
|
||||||
public boolean isError() {
|
public boolean isError() {
|
||||||
return this.isError;
|
return this.isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAttemptReconnect() {
|
||||||
|
return this.attemptReconnect;
|
||||||
|
}
|
||||||
|
|
||||||
State(final boolean isError) {
|
State(final boolean isError) {
|
||||||
|
this(isError,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
State(final boolean isError, final boolean reconnect) {
|
||||||
this.isError = isError;
|
this.isError = isError;
|
||||||
|
this.attemptReconnect = reconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
State() {
|
State() {
|
||||||
this(false);
|
this(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getReadableId() {
|
public int getReadableId() {
|
||||||
|
@ -375,7 +375,7 @@ public class XmppConnectionService extends Service {
|
|||||||
reconnectAccount(account, true, false);
|
reconnectAccount(account, true, false);
|
||||||
} else if (account.getStatus() != Account.State.CONNECTING && account.getStatus() != Account.State.NO_INTERNET) {
|
} else if (account.getStatus() != Account.State.CONNECTING && account.getStatus() != Account.State.NO_INTERNET) {
|
||||||
resetSendingToWaiting(account);
|
resetSendingToWaiting(account);
|
||||||
if (connection != null) {
|
if (connection != null && account.getStatus().isAttemptReconnect()) {
|
||||||
final int next = connection.getTimeToNextAttempt();
|
final int next = connection.getTimeToNextAttempt();
|
||||||
final boolean lowPingTimeoutMode = isInLowPingTimeoutMode(account);
|
final boolean lowPingTimeoutMode = isInLowPingTimeoutMode(account);
|
||||||
if (next <= 0) {
|
if (next <= 0) {
|
||||||
@ -749,7 +749,7 @@ public class XmppConnectionService extends Service {
|
|||||||
|
|
||||||
private boolean processAccountState(Account account, boolean interactive, boolean isUiAction, boolean isAccountPushed, HashSet<Account> pingCandidates) {
|
private boolean processAccountState(Account account, boolean interactive, boolean isUiAction, boolean isAccountPushed, HashSet<Account> pingCandidates) {
|
||||||
boolean pingNow = false;
|
boolean pingNow = false;
|
||||||
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
if (account.getStatus().isAttemptReconnect()) {
|
||||||
if (!hasInternetConnection()) {
|
if (!hasInternetConnection()) {
|
||||||
account.setStatus(Account.State.NO_INTERNET);
|
account.setStatus(Account.State.NO_INTERNET);
|
||||||
if (statusListener != null) {
|
if (statusListener != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user