1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge pull request #1746 from profanity-im/replay-queue

fixup 11f52ad547
This commit is contained in:
Michael Vetter 2022-08-08 17:51:30 +02:00 committed by GitHub
commit 712fdc475f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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