1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel 2022-08-08 17:15:58 +02:00
parent 082de13638
commit 65acffcf07

View File

@ -1000,12 +1000,15 @@ _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status
// lost connection for unknown reason // lost connection for unknown reason
if (conn.conn_status == JABBER_CONNECTED) { if (conn.conn_status == JABBER_CONNECTED) {
int send_queue_len = xmpp_conn_send_queue_len(conn.xmpp_conn);
log_debug("Connection handler: Lost connection for unknown reason"); log_debug("Connection handler: Lost connection for unknown reason");
conn.sm_state = xmpp_conn_get_sm_state(conn.xmpp_conn); conn.sm_state = xmpp_conn_get_sm_state(conn.xmpp_conn);
conn.queued_messages = calloc(xmpp_conn_send_queue_len(conn.xmpp_conn) + 1, sizeof(*conn.queued_messages)); if (send_queue_len > 0) {
for (int n = 0; n < xmpp_conn_send_queue_len(conn.xmpp_conn); ++n) { conn.queued_messages = calloc(send_queue_len + 1, sizeof(*conn.queued_messages));
for (int n = 0; n < send_queue_len && conn.queued_messages[n]; ++n) {
conn.queued_messages[n] = xmpp_conn_send_queue_drop_element(conn.xmpp_conn, XMPP_QUEUE_OLDEST); conn.queued_messages[n] = xmpp_conn_send_queue_drop_element(conn.xmpp_conn, XMPP_QUEUE_OLDEST);
} }
}
session_lost_connection(); session_lost_connection();
// login attempt failed // login attempt failed