git » sdk » commit f5cbec0

Do not reconnect syncrounously

author Stephen Paul Weber
2026-04-29 03:08:21 UTC
committer Stephen Paul Weber
2026-04-29 03:13:01 UTC
parent 8dbdf565b223cebbe37c61b7f087e725585d8177

Do not reconnect syncrounously

Prevent infinite recursion, etc by trying again in a bit async

borogove/streams/XmppStropheStream.hx +9 -7

diff --git a/borogove/streams/XmppStropheStream.hx b/borogove/streams/XmppStropheStream.hx
index f19d01c..e5a7779 100644
--- a/borogove/streams/XmppStropheStream.hx
+++ b/borogove/streams/XmppStropheStream.hx
@@ -316,13 +316,15 @@ class XmppStropheStream extends GenericStream {
 				stream.ready = false;
 				stream.trigger("status/offline", {});
 				// Reconnect
-				StropheConn.connect_client(
-					conn,
-					null,
-					0,
-					cpp.Callable.fromStaticFunction(strophe_connect),
-					userdata
-				);
+				haxe.Timer.delay(() -> {
+					StropheConn.connect_client(
+						conn,
+						null,
+						0,
+						cpp.Callable.fromStaticFunction(strophe_connect),
+						userdata
+					);
+				}, 100);
 			}
 		}
 		if (event == untyped __cpp__("XMPP_CONN_FAIL")) {