summaryrefslogtreecommitdiffstats
path: root/ircxmpp.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);