]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Make sure long COPY commands send "* OK Hang in there" packets
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 27 Oct 2017 21:54:37 +0000 (00:54 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 30 Oct 2017 11:04:53 +0000 (13:04 +0200)
o_stream_nflush() already flushed the writes to kernel, and Linux should
have sent them after 200ms delay, so this probably doesn't fix anything.
Using uncork+cork is a bit clearer way to indicate that the data really
is wanted to be sent now.

src/imap/cmd-copy.c

index 708bf764480b4b7344bb559ab1b4020c6b455442..15830e4de382671e0ba5ad133e2b7b21f6c7ee80 100644 (file)
@@ -23,7 +23,9 @@ static void client_send_sendalive_if_needed(struct client *client)
        last_io = I_MAX(client->last_input, client->last_output);
        if (now - last_io > MAIL_STORAGE_STAYALIVE_SECS) {
                o_stream_nsend_str(client->output, "* OK Hang in there..\r\n");
-               o_stream_nflush(client->output);
+               /* make sure it doesn't get stuck on the corked stream */
+               o_stream_uncork(client->output);
+               o_stream_cork(client->output);
                client->last_output = now;
        }
 }
@@ -45,6 +47,8 @@ static int fetch_and_copy(struct client_command_context *cmd, bool move,
        string_t *src_uidset;
        int ret;
 
+       i_assert(o_stream_is_corked(client->output));
+
        src_uidset = t_str_new(256);
        msgset_generator_init(&srcset_ctx, src_uidset);