mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-11 11:45:01 -05:00
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);
|
Thread thread = new Thread(connection);
|
||||||
connection.setInteractive(interactive);
|
connection.setInteractive(interactive);
|
||||||
|
connection.prepareNewConnection();
|
||||||
thread.start();
|
thread.start();
|
||||||
scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode());
|
scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode());
|
||||||
} else {
|
} 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() {
|
protected void connect() {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting");
|
||||||
features.encryptionEnabled = false;
|
features.encryptionEnabled = false;
|
||||||
lastConnect = SystemClock.elapsedRealtime();
|
|
||||||
lastPingSent = SystemClock.elapsedRealtime();
|
|
||||||
lastDiscoStarted = Long.MAX_VALUE;
|
|
||||||
this.attempt++;
|
this.attempt++;
|
||||||
switch (account.getJid().getDomainpart()) {
|
switch (account.getJid().getDomainpart()) {
|
||||||
case "chat.facebook.com":
|
case "chat.facebook.com":
|
||||||
|
Loading…
Reference in New Issue
Block a user