summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 20:44:13 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 20:44:13 +0200
commit3911333cff907a2d15d6dac33199b59137487a93 (patch)
treee3d3bc8a68bc1e6511575000c9fb9ea8f2e35d2a
parentdns server. untested. compiles. (diff)
downloadircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar.gz
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar.bz2
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar.lz
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar.xz
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.tar.zst
ircxmpp-3911333cff907a2d15d6dac33199b59137487a93.zip
-rw-r--r--ircxmpp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ircxmpp.c b/ircxmpp.c
index 76e3a9f..d04ee3e 100644
--- a/ircxmpp.c
+++ b/ircxmpp.c
@@ -714,12 +714,14 @@ void ircxmpp_run_once (struct ircxmpp * ircxmpp) {
if (!ircxmpp->ctx || !ircxmpp->conn || (!xmpp_conn_is_connected(ircxmpp->conn)
&& !xmpp_conn_is_connecting(ircxmpp->conn))) {
LOG(ircxmpp, IRCXMPP_WARN, "XMPP control is DISCONNECTED! CONNECTING!");
- if (ircxmpp->conn)
- xmpp_conn_release(ircxmpp->conn);
- if (ircxmpp->ctx)
- xmpp_ctx_free(ircxmpp->ctx);
- ircxmpp->ctx = xmpp_ctx_new(NULL, &ircxmpp->xmpp_logger);
- ircxmpp->conn = xmpp_conn_new(ircxmpp->ctx);
+ if (!ircxmpp->bridges) { // bridges contain ctx inside of their conns.
+ if (ircxmpp->conn) // maybe conn can be freed but i don't know
+ xmpp_conn_release(ircxmpp->conn); // bottom line: ctx really can't be
+ if (ircxmpp->ctx)
+ xmpp_ctx_free(ircxmpp->ctx);
+ ircxmpp->ctx = xmpp_ctx_new(NULL, &ircxmpp->xmpp_logger);
+ ircxmpp->conn = xmpp_conn_new(ircxmpp->ctx);
+ }
xmpp_conn_set_jid(ircxmpp->conn, ircxmpp->jid);
xmpp_conn_set_pass(ircxmpp->conn, ircxmpp->password);
xmpp_connect_client(ircxmpp->conn, NULL, 0, conn_handler, ircxmpp);