mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 20:22:05 +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:
parent
3c74ef2fd2
commit
352e422562
1 changed files with 6 additions and 2 deletions
|
@ -399,8 +399,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
LOGGER.fine("Stream resumption failed, continuing with normal stream establishment process");
|
LOGGER.fine("Stream resumption failed, continuing with normal stream establishment process");
|
||||||
}
|
}
|
||||||
|
|
||||||
bindResourceAndEstablishSession(resource);
|
|
||||||
|
|
||||||
List<Stanza> previouslyUnackedStanzas = new LinkedList<Stanza>();
|
List<Stanza> previouslyUnackedStanzas = new LinkedList<Stanza>();
|
||||||
if (unacknowledgedStanzas != null) {
|
if (unacknowledgedStanzas != null) {
|
||||||
// There was a previous connection with SM enabled but that was either not resumable or
|
// 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.
|
// after the 'enable' stream element has been sent.
|
||||||
dropSmState();
|
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) {
|
if (isSmAvailable() && useSm) {
|
||||||
// Remove what is maybe left from previously stream managed sessions
|
// Remove what is maybe left from previously stream managed sessions
|
||||||
serverHandledStanzasCount = 0;
|
serverHandledStanzasCount = 0;
|
||||||
|
|
Loading…
Reference in a new issue