From 133abd096db609274e9ee05a75cda387ef6b9f0e Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Tue, 7 Jan 2020 22:16:11 +0200 Subject: [PATCH] conn: disconnect if user destroys an active connection object Backported from UnrealEngine project. --- src/conn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conn.c b/src/conn.c index 9b78cc9..ed519f1 100644 --- a/src/conn.c +++ b/src/conn.c @@ -254,6 +254,12 @@ int xmpp_conn_release(xmpp_conn_t * const conn) else { ctx = conn->ctx; + if (conn->state == XMPP_STATE_CONNECTING || + conn->state == XMPP_STATE_CONNECTED) + { + conn_disconnect(conn); + } + /* remove connection from context's connlist */ if (ctx->connlist->conn == conn) { item = ctx->connlist;