diff options
author | Christian S <christian@pix-art.de> | 2016-01-17 11:46:10 +0100 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2016-01-17 11:46:10 +0100 |
commit | ae60bc265191eeb31bd5e96b030059ec4bd84027 (patch) | |
tree | 50b424b30a60c7ccee8cdf68398c77630da45d59 /src/main/java/eu/siacs/conversations/services | |
parent | ebfaa84167614c7c23b0593950704a343571ee4a (diff) | |
parent | ba143a27309657ce6694b0acaf2fb34069b79313 (diff) |
Merge branch 'siacs/master' into development
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 6e3e626a5..a295b2cee 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2451,11 +2451,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa private void reconnectAccount(final Account account, final boolean force, final boolean interactive) { synchronized (account) { - if (account.getXmppConnection() != null) { + XmppConnection connection = account.getXmppConnection(); + if (connection != null) { disconnect(account, force); + } else { + connection = createConnection(account); + account.setXmppConnection(connection); } if (!account.isOptionSet(Account.OPTION_DISABLED)) { - synchronized (this.mInProgressAvatarFetches) { for (Iterator<String> iterator = this.mInProgressAvatarFetches.iterator(); iterator.hasNext(); ) { final String KEY = iterator.next(); @@ -2464,10 +2467,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } } - - if (account.getXmppConnection() == null) { - account.setXmppConnection(createConnection(account)); - } else if (!force) { + if (!force) { try { Log.d(Config.LOGTAG, "wait for disconnect"); Thread.sleep(500); //sleep wait for disconnect @@ -2475,13 +2475,13 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa //ignored } } - Thread thread = new Thread(account.getXmppConnection()); - account.getXmppConnection().setInteractive(interactive); + Thread thread = new Thread(connection); + connection.setInteractive(interactive); thread.start(); scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode()); } else { account.getRoster().clearPresences(); - account.setXmppConnection(null); + connection.resetEverything(); } } } |