]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Move disconnected-check inside client_continue_pending_input()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Oct 2020 10:52:16 +0000 (12:52 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 1 Dec 2020 08:40:45 +0000 (08:40 +0000)
This way all of its callers don't have to check if the client is
disconnected.

src/imap/cmd-append.c
src/imap/cmd-idle.c
src/imap/imap-client.c
src/imap/imap-search.c
src/imap/main.c

index c7b5435b0b80bb7c4a4f19eec77917439740897f..84ceb61feade4238c4412bae75a64b60974ef5b5 100644 (file)
@@ -122,10 +122,7 @@ static void client_input_append(struct client_command_context *cmd)
        cmd_sync_delayed(client);
        o_stream_uncork(client->output);
 
-       if (client->disconnected)
-               client_destroy(client, NULL);
-       else
-               client_continue_pending_input(client);
+       client_continue_pending_input(client);
 }
 
 static void cmd_append_finish(struct cmd_append_context *ctx)
index 328d951b3bc3df9e858871ca6ac49108c695e248..8a05582d0378d218163feaf285a2eac534562f92 100644 (file)
@@ -101,12 +101,8 @@ static void idle_client_input(struct cmd_idle_context *ctx)
 {
        struct client *client = ctx->client;
 
-       if (idle_client_input_more(ctx)) {
-               if (client->disconnected)
-                       client_destroy(client, NULL);
-               else
-                       client_continue_pending_input(client);
-       }
+       if (idle_client_input_more(ctx))
+               client_continue_pending_input(client);
 }
 
 static void keepalive_timeout(struct cmd_idle_context *ctx)
index 8b1a9fbcd0ad9847a674ad24cecd8dd3eec603dd..ca5db576b2066fca8c4460f9d765486da978c70a 100644 (file)
@@ -1093,6 +1093,11 @@ void client_continue_pending_input(struct client *client)
 {
        i_assert(!client->handling_input);
 
+       if (client->disconnected) {
+               client_destroy(client, NULL);
+               return;
+       }
+
        /* this function is called at the end of I/O callbacks (and only there).
           fix up the command states and verify that they're correct. */
        while (client_remove_pending_unambiguity(client)) {
@@ -1357,10 +1362,7 @@ void client_input(struct client *client)
        o_stream_unref(&output);
        imap_refresh_proctitle();
 
-       if (client->disconnected)
-               client_destroy(client, NULL);
-       else
-               client_continue_pending_input(client);
+       client_continue_pending_input(client);
 }
 
 static void client_output_cmd(struct client_command_context *cmd)
index bb0f9deacd3d01a3509ef504fc9c75139022768c..8b5d6601098699534f31773ad73a192cd0253283 100644 (file)
@@ -482,10 +482,7 @@ static void cmd_search_more_callback(struct client_command_context *cmd)
                client_command_free(&cmd);
        cmd_sync_delayed(client);
 
-       if (client->disconnected)
-               client_destroy(client, NULL);
-       else
-               client_continue_pending_input(client);
+       client_continue_pending_input(client);
 }
 
 int cmd_search_parse_return_if_found(struct imap_search_context *ctx,
index 776ad53b1f6e6c06f9d1950befa7e426eddc6423..90a4cf1d29baaae32f3f1ebe076cb5a52b5ad68b 100644 (file)
@@ -227,10 +227,7 @@ client_add_input_finalize(struct client *client)
 
        /* we could have already handled LOGOUT, or we might need to continue
           pending ambiguous commands. */
-       if (client->disconnected)
-               client_destroy(client, NULL);
-       else
-               client_continue_pending_input(client);
+       client_continue_pending_input(client);
 }
 
 int client_create_from_input(const struct mail_storage_service_input *input,