conn: disconnect if user destroys an active connection object

Backported from UnrealEngine project.
This commit is contained in:
Dmitry Podgorny
2020-01-07 22:16:11 +02:00
parent cecd6b20e8
commit 133abd096d

View File

@@ -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;