On Fri, 2008-06-13 at 11:04 +0200, Bruno Prémont wrote:
> The attached patch makes dovecot send the whole answer in a single
> packet, thus not triggering the delay issue.

Although the patch works for this APPEND case, it probably adds delays
when other commands are pipelined, because tagged replies can be sent in
the middle of processing multiple commands.

Could you try if the attached patch fixes this also?

diff -r ad933a630f77 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Fri Jun 13 12:04:01 2008 +0300
+++ b/src/imap/cmd-append.c	Fri Jun 13 12:25:26 2008 +0300
@@ -38,6 +38,7 @@
 {
 	struct cmd_append_context *ctx = cmd->context;
 	struct client *client = cmd->client;
+	struct ostream *output = client->output;
 	bool finished;
 
 	i_assert(!client->destroyed);
@@ -73,15 +74,17 @@
 		return;
 	}
 
-	o_stream_cork(client->output);
+	o_stream_ref(output);
+	o_stream_cork(output);
 	finished = cmd->func(cmd);
-	o_stream_uncork(client->output);
 	if (!finished && cmd->state != CLIENT_COMMAND_STATE_DONE)
 		(void)client_handle_unfinished_cmd(cmd);
 	else
 		client_command_free(&cmd);
 	(void)cmd_sync_delayed(client);
 	client_continue_pending_input(&client);
+	o_stream_uncork(output);
+	o_stream_unref(&output);
 }
 
 /* Returns -1 = error, 0 = need more data, 1 = successful. flags and

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to