From: Timo Sirainen Date: Mon, 22 Apr 2024 07:59:37 +0000 (+0300) Subject: lib-imap-client: Fix automatic reconnecting with delayed logins X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1c45ac2fbb6c3db0fe3c8df137d1bb5876cd234;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c index f025403481..dd1ea22df1 100644 --- a/src/lib-imap-client/imapc-connection.c +++ b/src/lib-imap-client/imapc-connection.c @@ -1893,11 +1893,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;