diff options
-rw-r--r-- | ircxmpp.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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); |