be more careful to avoid creating multiple connections
This commit is contained in:
parent
b51ce43d36
commit
7df24407dc
|
@ -2578,6 +2578,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
}
|
||||
Thread thread = new Thread(connection);
|
||||
connection.setInteractive(interactive);
|
||||
connection.prepareNewConnection();
|
||||
thread.start();
|
||||
scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode());
|
||||
} else {
|
||||
|
|
|
@ -219,12 +219,16 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
public void prepareNewConnection() {
|
||||
this.lastConnect = SystemClock.elapsedRealtime();
|
||||
this.lastPingSent = SystemClock.elapsedRealtime();
|
||||
this.lastDiscoStarted = Long.MAX_VALUE;
|
||||
this.changeStatus(Account.State.CONNECTING);
|
||||
}
|
||||
|
||||
protected void connect() {
|
||||
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting");
|
||||
features.encryptionEnabled = false;
|
||||
lastConnect = SystemClock.elapsedRealtime();
|
||||
lastPingSent = SystemClock.elapsedRealtime();
|
||||
lastDiscoStarted = Long.MAX_VALUE;
|
||||
this.attempt++;
|
||||
switch (account.getJid().getDomainpart()) {
|
||||
case "chat.facebook.com":
|
||||
|
|
Loading…
Reference in a new issue