From 6f3b8f64d17c84e7baac78b1efa72400859f67e6 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 8 May 2016 21:45:18 +0200 Subject: check for h attribute in 'failed' nonza --- .../java/eu/siacs/conversations/xmpp/XmppConnection.java | 12 +++++++++--- 1 file 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 26610561..36424482 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -537,12 +537,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(); -- cgit v1.2.3