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.
This commit is contained in:
mathieui 2021-01-23 16:14:59 +01:00
parent efdcd396d8
commit 8700f8d162

View file

@ -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.