diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/TagWriter.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/TagWriter.java b/src/main/java/de/pixart/messenger/xml/TagWriter.java index c96841d56..699e527fa 100644 --- a/src/main/java/de/pixart/messenger/xml/TagWriter.java +++ b/src/main/java/de/pixart/messenger/xml/TagWriter.java @@ -1,10 +1,13 @@ package de.pixart.messenger.xml; +import android.util.Log; + import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.concurrent.LinkedBlockingQueue; +import de.pixart.messenger.Config; import de.pixart.messenger.xmpp.stanzas.AbstractStanza; public class TagWriter { @@ -71,6 +74,7 @@ public class TagWriter { public TagWriter writeStanzaAsync(AbstractStanza stanza) { if (finshed) { + Log.d(Config.LOGTAG, "attempting to write stanza to finished TagWriter"); return this; } else { if (!asyncStanzaWriter.isAlive()) { 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(); |