]> 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)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 29 Apr 2024 18:13:34 +0000 (18:13 +0000)
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 17a4f94c010d5c1c05f9e28ccc9ec9526f1e30fc..1d2f20e6e7d62084f54ed1a0e269e476b9bd4149 100644 (file)
@@ -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;