From 0dd871950fdc5e589bea56bc2a1023303862272f Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 12 Mar 2026 14:21:58 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20stoppe=20l'event=20loop=20asyncio=20sur?= =?UTF-8?q?=20disconnected/connection=5Ffailed=20pour=20d=C3=A9bloquer=20l?= =?UTF-8?q?a=20reconnexion=20automatique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agents_core/xmpp_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agents_core/xmpp_client.py b/agents_core/xmpp_client.py index 9319848..cff6705 100644 --- a/agents_core/xmpp_client.py +++ b/agents_core/xmpp_client.py @@ -212,6 +212,8 @@ class _SlixClient(ClientXMPP): self.add_event_handler("session_start", self._on_session_start) self.add_event_handler("message", self._on_message) self.add_event_handler("groupchat_message", self._on_muc_message) + self.add_event_handler("disconnected", self._on_disconnected) + self.add_event_handler("connection_failed", self._on_disconnected) def _setup_omemo(self): try: @@ -239,6 +241,10 @@ class _SlixClient(ClientXMPP): if self._on_connected_cb: self._on_connected_cb() + def _on_disconnected(self, event): + if hasattr(self, 'loop') and self.loop and self.loop.is_running(): + self.loop.call_soon_threadsafe(self.loop.stop) + def _on_message(self, msg): if msg["type"] in ("chat", "normal") and msg["body"]: body = msg["body"].strip()