1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-21 22:02:06 +01:00

[tcp] Mark SM as disabled prior resource binding

Otherwise we may send a SM ack request with the bind IQ request,
causing a stream error:

D/SMACK: SENT (0):
    <iq id='SETVB-74' type='set'>
      <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
      </bind>
    </iq>
    <r xmlns='urn:xmpp:sm:3'/>
D/SMACK: RECV (0):
    <iq id='SETVB-74' type='result'>
      <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
        <jid>
          snakeman@wiuwiu.de/eHeTGlCq
        </jid>
      </bind>
    </iq>
    <stream:error>
      <unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
    </stream:error>
    </stream:stream>
This commit is contained in:
Florian Schmaus 2020-07-20 14:23:09 +02:00
parent 2edf27f5da
commit bcfe7b12a4

View file

@ -407,6 +407,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
LOGGER.fine("Stream resumption failed, continuing with normal stream establishment process: " + smResumptionFailed);
}
// We either failed to resume a previous stream management (SM) session, or we did not even try. In any case,
// mark SM as not enabled. Most importantly, we do this prior calling bindResourceAndEstablishSession(), as the
// bind IQ may trigger a SM ack request, which would be invalid in the pre resource bound state.
smEnabledSyncPoint = false;
List<Stanza> previouslyUnackedStanzas = new LinkedList<Stanza>();
if (unacknowledgedStanzas != null) {
// There was a previous connection with SM enabled but that was either not resumable or
@ -425,7 +430,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// unacknowledgedStanzas and become duplicated on reconnect. See SMACK-706.
bindResourceAndEstablishSession(resource);
smEnabledSyncPoint = false;
if (isSmAvailable() && useSm) {
// Remove what is maybe left from previously stream managed sessions
serverHandledStanzasCount = 0;