From 401b336c846089939720908974de79c937d9e49f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 28 Oct 2017 00:54:37 +0300 Subject: [PATCH] imap: Make sure long COPY commands send "* OK Hang in there" packets 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/imap/cmd-copy.c b/src/imap/cmd-copy.c index 708bf76448..15830e4de3 100644 --- a/src/imap/cmd-copy.c +++ b/src/imap/cmd-copy.c @@ -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); -- 2.47.3