]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-client: Fix automatic reconnecting with delayed logins
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 22 Apr 2024 07:59:37 +0000 (10:59 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 3 May 2024 07:34:29 +0000 (10:34 +0300)
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

index f0254034817392aea872c993850db404cfcd55c3..dd1ea22df1d4c25213a1343b8deed711fcb2596f 100644 (file)
@@ -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;