From db8a542f3d95c7e03ad160fd8f73d4b01994c906 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 22 Apr 2024 10:59:37 +0300 Subject: [PATCH] lib-imap-client: Fix automatic reconnecting with delayed logins reconnect_command_count was always set to 1, because there was always the command that triggered the connection. It was never reset to 0, which caused reconnects to never happen. --- src/lib-imap-client/imapc-connection.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c index 17a4f94c01..1d2f20e6e7 100644 --- a/src/lib-imap-client/imapc-connection.c +++ b/src/lib-imap-client/imapc-connection.c @@ -1883,11 +1883,14 @@ void imapc_connection_connect(struct imapc_connection *conn) return; } - conn->reconnecting = FALSE; - /* if we get disconnected before we've finished all the pending - commands, don't reconnect */ - conn->reconnect_command_count = array_count(&conn->cmd_wait_list) + - array_count(&conn->cmd_send_queue); + if (conn->reconnecting) { + conn->reconnecting = FALSE; + /* if we get disconnected before we've finished all the pending + commands, don't reconnect */ + conn->reconnect_command_count = + array_count(&conn->cmd_wait_list) + + array_count(&conn->cmd_send_queue); + } imapc_connection_input_reset(conn); conn->last_connect = ioloop_timeval; -- 2.47.3