Fix event loop closed exception when restarting

master
Ken 2024-01-14 22:47:40 +00:00
parent d1afbd94b6
commit 85a47f1b66
1 changed files with 10 additions and 3 deletions

View File

@ -415,11 +415,18 @@ class XmppTransport(slixmpp.ClientXMPP):
self.logger.error("XMPPTransport run exception %s", err)
finally:
self.loop.close()
self.logger.debug("Event loop closed on XMPP overlay=%s", self._overlay_id)
self.logger.debug(
"Event loop closed on XMPP transport %s", self._overlay_id
)
def shutdown(self):
self.logger.debug("Initiating shutdown of XMPP overlay %s", self._overlay_id)
self.loop.call_soon_threadsafe(self.disconnect, 2, "controller shutdown", True)
if self.is_connected() and self.loop.is_running():
self.logger.debug(
"Initiating shutdown of XMPP transport %s", self._overlay_id
)
self.loop.call_soon_threadsafe(
self.disconnect, 2, "controller shutdown", True
)
class XmppCircle: