Stream Management resume failure sometimes not handled correctly
Bug description
Gajim doesn't handle a failed resume correctly.
Steps to reproduce
-
Connect and make sure Stream Management is enabled.
-
Restart the server (or otherwise get the server to close the stream and forget the SM id)
-
Wait for Gajim to reconnect and try to resume.
-
Get this:
\<!-- Out --> \<resume xmlns="urn:xmpp:sm:2" h="275" previd="20d5ad52-2187-4d53-9dea-71101b8c974e" /> \<!-- In --> \<failed xmlns='urn:xmpp:sm:2'> \<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> \</failed> \<!-- Out --> \<r xmlns="urn:xmpp:sm:2" /> \<!-- In --> \<stream:error> \<unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/> \</stream:error> \</stream:stream>
Gajim should not send any \<r/>
until it gets \<resumed/>
, (same applies to \<enable/>
) and on \<failed/>
it should assume the old session is lost and continue with \<enable/>
instead.
Also, resumption shouldn't be attempted after a clean stream closure.