1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Drop SM state *before* binding the resource

as otherwise <bind/> and <session/> may be duplicated on reconnect.

Fixes SMACK-706.
This commit is contained in:
Florian Schmaus 2015-12-03 13:30:44 +01:00
parent 3c74ef2fd2
commit 352e422562

View file

@ -399,8 +399,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
LOGGER.fine("Stream resumption failed, continuing with normal stream establishment process");
}
bindResourceAndEstablishSession(resource);
List<Stanza> previouslyUnackedStanzas = new LinkedList<Stanza>();
if (unacknowledgedStanzas != null) {
// There was a previous connection with SM enabled but that was either not resumable or
@ -413,6 +411,12 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// after the 'enable' stream element has been sent.
dropSmState();
}
// Now bind the resource. It is important to do this *after* we dropped an eventually
// existing Stream Management state. As otherwise <bind/> and <session/> may end up in
// unacknowledgedStanzas and become duplicated on reconnect. See SMACK-706.
bindResourceAndEstablishSession(resource);
if (isSmAvailable() && useSm) {
// Remove what is maybe left from previously stream managed sessions
serverHandledStanzasCount = 0;