47 lines
1.4 KiB
Diff
47 lines
1.4 KiB
Diff
From eea57c8683325f9767b2eb1b44a0b23352541c1e Mon Sep 17 00:00:00 2001
|
|
From: Timo Sirainen <timo.sirainen@open-xchange.com>
|
|
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 07b2a8018b..0bf03caa97 100644
|
|
--- a/src/imap/imap-client.c
|
|
+++ b/src/imap/imap-client.c
|
|
@@ -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);
|