]> 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>
Fri, 6 Nov 2020 15:08:05 +0000 (17:08 +0200)
src/imap/imap-client.c

index 8b1a9fbcd0ad9847a674ad24cecd8dd3eec603dd..2732593e81098a16edf1c8c8d9d8ff7d08c1bb7e 100644 (file)
@@ -1169,6 +1169,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;
@@ -1232,11 +1245,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);