Try/except around outbound stanza processing

to avoid killing the send loop when a filter has an error
This commit is contained in:
mathieui 2019-08-22 16:13:24 +02:00
parent a32794ec35
commit 27d3ae958b
No known key found for this signature in database
GPG Key ID: C59F84CEEFD616E3

View File

@ -902,6 +902,7 @@ class XMLStream(asyncio.BaseProtocol):
"""
while True:
(data, use_filters) = await self.waiting_queue.get()
try:
if isinstance(data, ElementBase):
if use_filters:
for filter in self.__filters['out']:
@ -926,6 +927,8 @@ class XMLStream(asyncio.BaseProtocol):
self.send_raw(str_data)
else:
self.send_raw(data)
except:
log.error('Could not send stanza %s', data, exc_info=True)
self.waiting_queue.task_done()
def send(self, data, use_filters=True):