mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-20 17: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:
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");
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue