diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-02-14 20:47:47 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-02-14 20:47:47 +0100 |
commit | 4bb8b5a38dfda4041664c209135eae088a17a5ce (patch) | |
tree | ee852b25f8697a069f074e97ad543c53fbcff4c2 /src/main/java/de/pixart/messenger/xmpp | |
parent | 8b3ca970caa286e7e7216d6753c0ddc8ec8c04c5 (diff) |
only force close tagwriter before creating a new one
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 1cec0c909..9cb852ea9 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -221,7 +221,6 @@ public class XmppConnection implements Runnable { this.account = account; this.wakeLock = service.getPowerManager().newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, account.getJid().toBareJid().toString()); - tagWriter = new TagWriter(); mXmppConnectionService = service; } @@ -263,8 +262,6 @@ public class XmppConnection implements Runnable { try { Socket localSocket; shouldAuthenticate = needsBinding = !account.isOptionSet(Account.OPTION_REGISTER); - tagReader = new XmlReader(wakeLock); - tagWriter = new TagWriter(); this.changeStatus(Account.State.CONNECTING); final boolean useTor = mXmppConnectionService.useTorToConnect() || account.isOnion(); final boolean extended = mXmppConnectionService.showExtendedConnectionOptions(); @@ -482,6 +479,9 @@ public class XmppConnection implements Runnable { throw new InterruptedException(); } this.socket = socket; + tagReader = new XmlReader(wakeLock); + if (tagWriter != null) tagWriter.forceClose(); + tagWriter = new TagWriter(); tagWriter.setOutputStream(socket.getOutputStream()); tagReader.setInputStream(socket.getInputStream()); tagWriter.beginDocument(); @@ -1386,9 +1386,6 @@ public class XmppConnection implements Runnable { } private void forceCloseSocket() { - if (tagWriter != null) { - tagWriter.forceClose(); - } if (socket != null) { try { socket.close(); |