mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-20 17:47:57 +01:00
Empty unacknowledgedStanzas when 'resumed' is received
by changing stanzasToResend.addAll(unacknowledgedStanzas); to unacknowledgedStanzas.drainTo(stanzasToResend); Also use sendStanzaInternal to call the callbacks, which also requires the smEnabledSyncPoint to got signaled. Fixes SMACK-700. Thanks to Juan Antonio for reporting this.
This commit is contained in:
parent
4f39c5b9c9
commit
f5115f4666
1 changed files with 6 additions and 5 deletions
|
@ -1086,16 +1086,17 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
if (!smSessionId.equals(resumed.getPrevId())) {
|
if (!smSessionId.equals(resumed.getPrevId())) {
|
||||||
throw new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());
|
throw new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());
|
||||||
}
|
}
|
||||||
|
// Mark SM as enabled and resumption as successful.
|
||||||
|
smResumedSyncPoint.reportSuccess();
|
||||||
|
smEnabledSyncPoint.reportSuccess();
|
||||||
// First, drop the stanzas already handled by the server
|
// First, drop the stanzas already handled by the server
|
||||||
processHandledCount(resumed.getHandledCount());
|
processHandledCount(resumed.getHandledCount());
|
||||||
// Then re-send what is left in the unacknowledged queue
|
// Then re-send what is left in the unacknowledged queue
|
||||||
List<Stanza> stanzasToResend = new LinkedList<Stanza>();
|
List<Stanza> stanzasToResend = new ArrayList<>(unacknowledgedStanzas.size());
|
||||||
stanzasToResend.addAll(unacknowledgedStanzas);
|
unacknowledgedStanzas.drainTo(stanzasToResend);
|
||||||
for (Stanza stanza : stanzasToResend) {
|
for (Stanza stanza : stanzasToResend) {
|
||||||
packetWriter.sendStreamElement(stanza);
|
sendStanzaInternal(stanza);
|
||||||
}
|
}
|
||||||
smResumedSyncPoint.reportSuccess();
|
|
||||||
smEnabledSyncPoint.reportSuccess();
|
|
||||||
// If there where stanzas resent, then request a SM ack for them.
|
// If there where stanzas resent, then request a SM ack for them.
|
||||||
// Writer's sendStreamElement() won't do it automatically based on
|
// Writer's sendStreamElement() won't do it automatically based on
|
||||||
// predicates.
|
// predicates.
|
||||||
|
|
Loading…
Reference in a new issue