code clean up for resumed processing
This commit is contained in:
parent
f6ab3dd068
commit
7ea4f64ce4
|
@ -694,17 +694,26 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
private void processResumed(final Element resumed) {
|
||||
private void processResumed(final Element resumed) throws StateChangingException {
|
||||
this.inSmacksSession = true;
|
||||
this.isBound = true;
|
||||
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
|
||||
lastPacketReceived = SystemClock.elapsedRealtime();
|
||||
final String h = resumed.getAttribute("h");
|
||||
if (h == null) {
|
||||
resetStreamId();
|
||||
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||
}
|
||||
final int serverCount;
|
||||
try {
|
||||
ArrayList<AbstractAcknowledgeableStanza> failedStanzas = new ArrayList<>();
|
||||
serverCount = Integer.parseInt(h);
|
||||
} catch (final NumberFormatException e) {
|
||||
resetStreamId();
|
||||
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||
}
|
||||
final ArrayList<AbstractAcknowledgeableStanza> failedStanzas = new ArrayList<>();
|
||||
final boolean acknowledgedMessages;
|
||||
synchronized (this.mStanzaQueue) {
|
||||
final int serverCount = Integer.parseInt(h);
|
||||
if (serverCount < stanzasSent) {
|
||||
Log.d(
|
||||
Config.LOGTAG,
|
||||
|
@ -724,11 +733,8 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
Log.d(
|
||||
Config.LOGTAG,
|
||||
account.getJid().asBareJid()
|
||||
+ ": resending "
|
||||
+ failedStanzas.size()
|
||||
+ " stanzas");
|
||||
for (AbstractAcknowledgeableStanza packet : failedStanzas) {
|
||||
account.getJid().asBareJid() + ": resending " + failedStanzas.size() + " stanzas");
|
||||
for (final AbstractAcknowledgeableStanza packet : failedStanzas) {
|
||||
if (packet instanceof MessagePacket) {
|
||||
MessagePacket message = (MessagePacket) packet;
|
||||
mXmppConnectionService.markMessage(
|
||||
|
@ -739,8 +745,6 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
sendPacket(packet);
|
||||
}
|
||||
} catch (final NumberFormatException ignored) {
|
||||
}
|
||||
Log.d(
|
||||
Config.LOGTAG,
|
||||
account.getJid().asBareJid() + ": online with resource " + account.getResource());
|
||||
|
|
Loading…
Reference in a new issue