]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Simplify connection choosing when a server command is finished
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Jul 2021 12:54:20 +0000 (15:54 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Jan 2022 11:52:09 +0000 (13:52 +0200)
The newly chosen connection is always the one that had just finished the
command.

src/doveadm/doveadm-mail-server.c

index 276794e015a16410b1805aa8ebf764ab00cb46f0..253ce56aebf53af0b657d1985b07a92b21769fde 100644 (file)
@@ -419,8 +419,9 @@ static void doveadm_cmd_callback(const struct doveadm_server_reply *reply,
                                 void *context)
 {
        struct doveadm_mail_server_cmd *servercmd = context;
+       struct server_connection *conn = servercmd->conn;
        struct doveadm_server *server =
-               server_connection_get_server(servercmd->conn);
+               server_connection_get_server(conn);
 
        switch (reply->exit_code) {
        case 0:
@@ -454,16 +455,12 @@ static void doveadm_cmd_callback(const struct doveadm_server_reply *reply,
        doveadm_mail_server_cmd_free(&servercmd);
 
        if (array_count(&server->queue) > 0) {
-               struct server_connection *conn;
                char *const *usernamep = array_front(&server->queue);
                char *username = *usernamep;
 
-               conn = doveadm_server_find_unused_conn(server);
-               if (conn != NULL) {
-                       array_pop_front(&server->queue);
-                       doveadm_mail_server_handle(conn, username);
-                       i_free(username);
-               }
+               array_pop_front(&server->queue);
+               doveadm_mail_server_handle(conn, username);
+               i_free(username);
        }
 
        io_loop_stop(current_ioloop);