mirror of
https://github.com/moparisthebest/Conversations
synced 2025-02-01 07:20:10 -05:00
reformating and upper bound for waiting on stanza writer
This commit is contained in:
parent
5298f4e2aa
commit
384c441990
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user