From d15a37e14653e9f86318bd2528523ec4f156e932 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 16 Feb 2022 22:11:19 +0100 Subject: fix: allow cancelling the run_filters coroutine otherwise it will leak forever into the event loop and generate tracebacks when closing it --- slixmpp/xmlstream/xmlstream.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'slixmpp/xmlstream/xmlstream.py') diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 67238cc6..7b362203 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -1239,7 +1239,7 @@ class XMLStream(asyncio.BaseProtocol): else: self.send_raw(data) - async def run_filters(self) -> NoReturn: + async def run_filters(self) -> None: """ Background loop that processes stanzas to send. """ @@ -1295,6 +1295,9 @@ class XMLStream(asyncio.BaseProtocol): self.send_raw(data) except ContinueQueue as exc: log.debug('Stanza in send queue not sent: %s', exc) + except asyncio.CancelledError: + log.debug('Send coroutine received cancel(), stopping') + return except Exception: log.error('Exception raised in send queue:', exc_info=True) self.waiting_queue.task_done() -- cgit v1.2.3