check for h attribute in 'failed' nonza

This commit is contained in:
Daniel Gultsch 2016-05-08 21:45:18 +02:00
parent 784df0c218
commit 6f3b8f64d1
1 changed files with 9 additions and 3 deletions

View File

@ -537,12 +537,18 @@ public class XmppConnection implements Runnable {
try { try {
final int serverSequence = Integer.parseInt(ack.getAttribute("h")); final int serverSequence = Integer.parseInt(ack.getAttribute("h"));
acknowledgeStanzaUpTo(serverSequence); acknowledgeStanzaUpTo(serverSequence);
} catch (NumberFormatException e) { } catch (NumberFormatException | NullPointerException e) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server send ack without sequence number"); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server send ack without sequence number");
} }
} else if (nextTag.isStart("failed")) { } else if (nextTag.isStart("failed")) {
tagReader.readElement(nextTag); Element failed = tagReader.readElement(nextTag);
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": resumption failed"); 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(); resetStreamId();
if (account.getStatus() != Account.State.ONLINE) { if (account.getStatus() != Account.State.ONLINE) {
sendBindRequest(); sendBindRequest();