aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-11-19 13:34:27 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-11-19 13:34:27 +0100
commit40c747660d84c6202236b5081f6d6830a8168ecb (patch)
treebbc79e4daaf8925172955afbfa92bb4b8f5cfe8f /src
parent8132480b825f7a116a05fc720935f6c6b81b7baf (diff)
removed some unecessary locking
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 0b33aa0c..8c691102 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -67,7 +67,6 @@ import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
-import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Bookmark;
@@ -298,7 +297,7 @@ public class XmppConnectionService extends Service {
mOnAccountUpdate.onAccountUpdate();
}
if (account.getStatus() == Account.State.ONLINE) {
- synchronized (XmppConnectionService.this) {
+ synchronized (mLowPingTimeoutMode) {
if (mLowPingTimeoutMode.remove(account.getJid().toBareJid())) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": leaving low ping timeout mode");
}
@@ -336,10 +335,10 @@ public class XmppConnectionService extends Service {
account.pendingConferenceJoins.clear();
scheduleWakeUpCall(Config.PING_MAX_INTERVAL, account.getUuid().hashCode());
} else {
- synchronized (XmppConnectionService.this) {
- if (account.getStatus() == Account.State.OFFLINE || account.getStatus() == Account.State.DISABLED) {
- resetSendingToWaiting(account);
- if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ if (account.getStatus() == Account.State.OFFLINE || account.getStatus() == Account.State.DISABLED) {
+ resetSendingToWaiting(account);
+ if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ synchronized (mLowPingTimeoutMode) {
if (mLowPingTimeoutMode.contains(account.getJid().toBareJid())) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": went into offline state during low ping mode. reconnecting now");
reconnectAccount(account, true, false);
@@ -348,20 +347,20 @@ public class XmppConnectionService extends Service {
scheduleWakeUpCall(timeToReconnect, account.getUuid().hashCode());
}
}
- } else if (account.getStatus() == Account.State.REGISTRATION_SUCCESSFUL) {
- databaseBackend.updateAccount(account);
- reconnectAccount(account, true, false);
- } else if ((account.getStatus() != Account.State.CONNECTING)
- && (account.getStatus() != Account.State.NO_INTERNET)) {
- resetSendingToWaiting(account);
- if (connection != null) {
- int next = connection.getTimeToNextAttempt();
- Log.d(Config.LOGTAG, account.getJid().toBareJid()
- + ": error connecting account. try again in "
- + next + "s for the "
- + (connection.getAttempt() + 1) + " time");
- scheduleWakeUpCall(next, account.getUuid().hashCode());
- }
+ }
+ } else if (account.getStatus() == Account.State.REGISTRATION_SUCCESSFUL) {
+ databaseBackend.updateAccount(account);
+ reconnectAccount(account, true, false);
+ } else if ((account.getStatus() != Account.State.CONNECTING)
+ && (account.getStatus() != Account.State.NO_INTERNET)) {
+ resetSendingToWaiting(account);
+ if (connection != null) {
+ int next = connection.getTimeToNextAttempt();
+ Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ + ": error connecting account. try again in "
+ + next + "s for the "
+ + (connection.getAttempt() + 1) + " time");
+ scheduleWakeUpCall(next, account.getUuid().hashCode());
}
}
}