From: Sergey Kitov Date: Mon, 12 Jun 2017 10:45:33 +0000 (+0300) Subject: imap: command_stats_start call is added for unknown commands. X-Git-Tag: 2.3.0.rc1~1422 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b2e48654bdf2ad716051954afcf18608e1ab5c9;p=thirdparty%2Fdovecot%2Fcore.git imap: command_stats_start call is added for unknown commands. This makes timing shown in reply to unknown commands correct --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index cfd7e9791b..0d1f098c84 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -1128,6 +1128,8 @@ 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); diff --git a/src/imap/imap-commands.c b/src/imap/imap-commands.c index 809ad5770d..f11816b964 100644 --- a/src/imap/imap-commands.c +++ b/src/imap/imap-commands.c @@ -160,7 +160,7 @@ void command_hook_unregister(command_hook_callback_t *pre, i_panic("command_hook_unregister(): hook not registered"); } -static void command_stats_start(struct client_command_context *cmd) +void command_stats_start(struct client_command_context *cmd) { cmd->stats_start.timeval = ioloop_timeval; cmd->stats_start.lock_wait_usecs = file_lock_wait_get_total_usecs(); diff --git a/src/imap/imap-commands.h b/src/imap/imap-commands.h index 7f2f67e6b7..651a6df9d0 100644 --- a/src/imap/imap-commands.h +++ b/src/imap/imap-commands.h @@ -60,6 +60,8 @@ void command_hook_unregister(command_hook_callback_t *pre, command_hook_callback_t *post); /* Execute command and hooks */ bool command_exec(struct client_command_context *cmd); +/* Starts counting command statistics. */ +void command_stats_start(struct client_command_context *cmd); /* Finish counting command statistics. This is called automatically when command_exec() returns, but it should be called explicitly if the stats are needed during command_exec(). */