diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-08-28 11:42:11 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-08-28 11:42:11 +0200 |
commit | 384c4419906fffeb9cc771ae922dd214aa2a5b6a (patch) | |
tree | 3dbf6fbd64b27eff9260a40b224f7c47bdb44a70 | |
parent | 5298f4e2aada48002cf34281d19a2c3e0caaaf77 (diff) |
reformating and upper bound for waiting on stanza writer
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 097cb818..f785546d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -722,11 +722,11 @@ public class XmppConnection implements Runnable { sendPostBindInitialization(); } } else { - Log.d(Config.LOGTAG,account.getJid()+": disconnecting because of bind failure"); + Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure"); disconnect(true); } } else { - Log.d(Config.LOGTAG,account.getJid()+": disconnecting because of bind failure"); + Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure"); disconnect(true); } } @@ -751,7 +751,7 @@ public class XmppConnection implements Runnable { for(OnIqPacketReceived callback : callbacks) { callback.onIqPacketReceived(account,failurePacket); } - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done clearing iq callbacks. "+this.packetCallbacks.size()+" left"); + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": done clearing iq callbacks. " + this.packetCallbacks.size() + " left"); } private void sendStartSession() { @@ -1036,15 +1036,23 @@ public class XmppConnection implements Runnable { if (tagWriter.isActive()) { tagWriter.finish(); try { - while (!tagWriter.finished() && socket.isConnected()) { - Log.d(Config.LOGTAG, "not yet finished"); - Thread.sleep(100); + int i = 0; + boolean warned = false; + while (!tagWriter.finished() && socket.isConnected() && i <= 10) { + if (!warned) { + Log.d(Config.LOGTAG, account.getJid().toBareJid()+": waiting for tag writer to finish"); + warned = true; + } + Thread.sleep(200); + i++; + } + if (warned) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": tag writer has finished"); } tagWriter.writeTag(Tag.end("stream:stream")); socket.close(); } catch (final IOException e) { - Log.d(Config.LOGTAG, - "io exception during disconnect"); + Log.d(Config.LOGTAG,"io exception during disconnect"); } catch (final InterruptedException e) { Log.d(Config.LOGTAG, "interrupted"); } |