Commit 74cf3a1e authored by Philipp Hörist's avatar Philipp Hörist

Dispatcher: Don't clear IQ callbacks on parser reset

Only clear IQ callbacks if we not resumed the stream
parent 42a4409f
......@@ -643,8 +643,9 @@ class Client(Observable):
self._on_bind(stanza)
elif self.state == StreamState.BIND_SUCCESSFUL:
self._smacks.send_enable()
self._dispatcher.clear_iq_callbacks()
self._dispatcher.set_dispatch_callback(None)
self._smacks.send_enable()
self.state = StreamState.ACTIVE
self.notify('connected')
......
......@@ -186,14 +186,11 @@ class StanzaDispatcher(Observable):
self.register_handler(*handler)
def reset_parser(self):
self._remove_timeout_source()
if self._parser is not None:
self._parser.dispatch = None
self._parser.destroy()
self._parser = None
self._id_callbacks.clear()
self._parser = NodeBuilder(dispatch_depth=2,
finished=False)
self._parser.dispatch = self.dispatch
......@@ -493,11 +490,15 @@ class StanzaDispatcher(Observable):
GLib.source_remove(self._timeout_id)
self._timeout_id = None
def clear_iq_callbacks(self):
self._log.info('Clear IQ callbacks')
self._id_callbacks.clear()
def cleanup(self):
self._client = None
self._modules = {}
self._parser = None
self._id_callbacks.clear()
self.clear_iq_callbacks()
self._dispatch_callback = None
self._handlers.clear()
self._remove_timeout_source()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment