From 253787d72f06abb59534b150ecd856cd803daba2 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 17 Aug 2020 17:59:19 +0300 Subject: [PATCH] imap: Split off client_command_failed_early() --- src/imap/imap-client.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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); -- 2.47.3