From 8700f8d162c4b863f045c2459d68406c04e35bad Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 23 Jan 2021 16:14:59 +0100 Subject: xmlstream: do not cancel the send filter task it does not make sense to cancel it, it does not do anything when the sending queue is empty, and clients should not fill the send queue when not connected anyway. --- slixmpp/xmlstream/xmlstream.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 77bb9e4a..5b245e11 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -272,7 +272,7 @@ class XMLStream(asyncio.BaseProtocol): localhost """ - if self._run_filters is None: + if self._run_filters is None or self._run_filters.done(): self._run_filters = asyncio.ensure_future( self.run_filters(), loop=self.loop, @@ -463,8 +463,6 @@ class XMLStream(asyncio.BaseProtocol): self.parser = None self.transport = None self.socket = None - if self._run_filters: - self._run_filters.cancel() # Fire the events after cleanup if self.end_session_on_disconnect: self.event('session_end') @@ -480,8 +478,6 @@ class XMLStream(asyncio.BaseProtocol): if self._current_connection_attempt: self._current_connection_attempt.cancel() self._current_connection_attempt = None - if self._run_filters: - self._run_filters.cancel() def disconnect(self, wait: float = 2.0, reason: Optional[str] = None, ignore_send_queue: bool = False) -> None: """Close the XML stream and wait for an acknowldgement from the server for @@ -975,7 +971,6 @@ class XMLStream(asyncio.BaseProtocol): else: self.send_raw(data) - async def run_filters(self): """ Background loop that processes stanzas to send. -- cgit v1.2.3