]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: command_stats_start call is added for unknown commands.
authorSergey Kitov <sergey.kitov@open-xchange.com>
Mon, 12 Jun 2017 10:45:33 +0000 (13:45 +0300)
committerSergey Kitov <sergey.kitov@open-xchange.com>
Tue, 13 Jun 2017 13:12:32 +0000 (16:12 +0300)
This makes timing shown in reply to unknown commands correct

src/imap/imap-client.c
src/imap/imap-commands.c
src/imap/imap-commands.h

index cfd7e9791b6b695f6b77bc69e53a65820d2d08a2..0d1f098c844384305792abf0d0e35b9888c37ef2 100644 (file)
@@ -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);
index 809ad5770d4c18e9912ed5398ebd04a3f3235c9d..f11816b964c83cb83a3ebfc76ff44a113ff763e1 100644 (file)
@@ -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();
index 7f2f67e6b78c49f0004faa0ab588e3624ad327b9..651a6df9d0877e096d90e262df5e1d471e7528bd 100644 (file)
@@ -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(). */