diff --git a/tools/jitsi-matrix-relay/jitsi_matrix_relay.py b/tools/jitsi-matrix-relay/jitsi_matrix_relay.py index 2bb41582..eade9a6c 100644 --- a/tools/jitsi-matrix-relay/jitsi_matrix_relay.py +++ b/tools/jitsi-matrix-relay/jitsi_matrix_relay.py @@ -18,6 +18,7 @@ import aiohttp import slixmpp from aiohttp import web +from slixmpp.exceptions import IqError, IqTimeout from slixmpp.xmlstream import ET env = os.environ @@ -72,7 +73,14 @@ async def start(self, _): **{"machine-uid": uuid.uuid4().hex}, ) ) - await iq.send() + try: + await iq.send() + except (IqError, IqTimeout): + # e.g. jicofo not up yet after a restart: an exception here + # would only end this handler and leave us outside the room + logging.exception("focus did not set up the room") + self.disconnect() + return presence = self.make_presence(pto=f"{MUC}/{self.id}") x = ET.SubElement(presence.xml, f"{{{MUC_NS}}}x") ET.SubElement(x, f"{{{MUC_NS}}}history", maxstanzas="0")