add xmpp_conn_send_queue_len()

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel
2021-07-06 11:14:58 +02:00
parent 27278c032b
commit d9acad3d91
3 changed files with 16 additions and 0 deletions

View File

@@ -1252,6 +1252,20 @@ int xmpp_conn_is_disconnected(xmpp_conn_t *conn)
return conn->state == XMPP_STATE_DISCONNECTED;
}
/**
* @return The number of entries in the send queue
*
* @ingroup Connections
*/
int xmpp_conn_send_queue_len(const xmpp_conn_t *conn)
{
if (conn->send_queue_head && conn->send_queue_head->written &&
conn->send_queue_head->owner == XMPP_QUEUE_USER)
return conn->send_queue_user_len - 1;
else
return conn->send_queue_user_len;
}
/* timed handler for cleanup if normal disconnect procedure takes too long */
static int _disconnect_cleanup(xmpp_conn_t *conn, void *userdata)
{