[dovecot-cvs] dovecot/src/imap client.c, 1.81, 1.82 cmd-append.c, 1.96, 1.97

tss at dovecot.org tss at dovecot.org
Mon Mar 26 00:53:13 EEST 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv9404

Modified Files:
	client.c cmd-append.c 
Log Message:
hang fix after appends



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- client.c	21 Mar 2007 19:16:44 -0000	1.81
+++ client.c	25 Mar 2007 21:53:11 -0000	1.82
@@ -367,16 +367,10 @@
 	if (!cmd->param_error)
 		client->bad_counter = 0;
 
-	if (client->input_lock == cmd) {
-		/* reset the input handler in case it was changed */
+	if (client->input_lock == cmd)
 		client->input_lock = NULL;
-	}
-	if (client->output_lock == cmd) {
-		/* reset the output handler in case it was changed */
-		o_stream_set_flush_callback(client->output,
-					    _client_output, client);
+	if (client->output_lock == cmd)
 		client->output_lock = NULL;
-	}
 
 	if (client->free_parser != NULL)
 		imap_parser_destroy(&cmd->parser);
@@ -619,7 +613,7 @@
 
 int _client_output(struct client *client)
 {
-	struct client_command_context *cmd;
+	struct client_command_context *cmd, *next;
 	int ret;
 
 	i_assert(!client->destroyed);
@@ -636,7 +630,8 @@
 		client_output_cmd(client->output_lock);
 	if (client->output_lock == NULL) {
 		cmd = client->command_queue;
-		for (; cmd != NULL; cmd = cmd->next) {
+		for (; cmd != NULL; cmd = next) {
+			next = cmd->next;
 			client_output_cmd(cmd);
 			if (client->output_lock != NULL)
 				break;

Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- cmd-append.c	15 Mar 2007 13:48:47 -0000	1.96
+++ cmd-append.c	25 Mar 2007 21:53:11 -0000	1.97
@@ -118,6 +118,10 @@
 	i_assert(ctx->client->input_lock == ctx->cmd);
 
 	io_remove(&ctx->client->io);
+	/* we must put back the original flush callback before beginning to
+	   sync (the command is still unfinished at that point) */
+	o_stream_set_flush_callback(ctx->client->output,
+				    _client_output, ctx->client);
 
 	if (ctx->input != NULL)
 		i_stream_unref(&ctx->input);



More information about the dovecot-cvs mailing list