]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Split off client_command_failed_early()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 17 Aug 2020 14:59:19 +0000 (17:59 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 4 Jan 2021 22:59:38 +0000 (00:59 +0200)
src/imap/imap-client.c

index 07b2a8018b12747e2fee77961c22237f0db81b92..0bf03caa97cfffaca34b22e908ccee997e999af1 100644 (file)
@@ -1176,6 +1176,19 @@ bool client_handle_unfinished_cmd(struct client_command_context *cmd)
        return TRUE;
 }
 
+static void
+client_command_failed_early(struct client_command_context **_cmd,
+                           const char *error)
+{
+       struct client_command_context *cmd = *_cmd;
+
+       io_loop_time_refresh();
+       command_stats_start(cmd);
+       client_send_command_error(cmd, error);
+       cmd->param_error = TRUE;
+       client_command_free(_cmd);
+}
+
 static bool client_command_input(struct client_command_context *cmd)
 {
        struct client *client = cmd->client;
@@ -1239,11 +1252,7 @@ static bool client_command_input(struct client_command_context *cmd)
 
        if (cmd->func == NULL) {
                /* unknown command */
-               io_loop_time_refresh();
-               command_stats_start(cmd);
-               client_send_command_error(cmd, "Unknown command.");
-               cmd->param_error = TRUE;
-               client_command_free(&cmd);
+               client_command_failed_early(&cmd, "Unknown command.");
                return TRUE;
        } else {
                i_assert(!client->disconnected);