From: Timo Sirainen Date: Mon, 17 Aug 2020 14:59:19 +0000 (+0300) Subject: imap: Split off client_command_failed_early() X-Git-Tag: 2.3.13~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=253787d72f06abb59534b150ecd856cd803daba2;p=thirdparty%2Fdovecot%2Fcore.git imap: Split off client_command_failed_early() --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 8b1a9fbcd0..2732593e81 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -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);