aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/xmpp
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-05-08 21:45:18 +0200
committerChristian Schneppe <christian@pix-art.de>2016-05-13 21:51:13 +0200
commit9593a471ba5ab7e59537f9202b044d0288fc0fcb (patch)
tree9019abb0a8aba78a189aff2da402a0dc3da61c4a /src/main/java/eu/siacs/conversations/xmpp
parent85a01f3121ce0248c1458de716d8dfeded5f8950 (diff)
check for h attribute in 'failed' nonza
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 687b51d81..2bebeb4c7 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -550,12 +550,18 @@ public class XmppConnection implements Runnable {
try {
final int serverSequence = Integer.parseInt(ack.getAttribute("h"));
acknowledgeStanzaUpTo(serverSequence);
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException | NullPointerException e) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server send ack without sequence number");
}
} else if (nextTag.isStart("failed")) {
- tagReader.readElement(nextTag);
- Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": resumption failed");
+ Element failed = tagReader.readElement(nextTag);
+ try {
+ final int serverCount = Integer.parseInt(failed.getAttribute("h"));
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": resumption failed but server acknowledged stanza #"+h);
+ acknowledgeStanzaUpTo(serverCount);
+ } catch (NumberFormatException | NullPointerException e) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": resumption failed");
+ }
resetStreamId();
if (account.getStatus() != Account.State.ONLINE) {
sendBindRequest();