diff src/imap/cmd-append.c @ 9095:9a0aa39a3a14 HEAD

imap: Cleaned up "command pending" handling code. Should fix hangs caused by recent changes.
author Timo Sirainen <tss@iki.fi>
date Tue, 26 May 2009 14:21:59 -0400
parents fa9bc4ef6f32
children 39c234ab0b21
line wrap: on
line diff
--- a/src/imap/cmd-append.c	Tue May 26 14:20:23 2009 -0400
+++ b/src/imap/cmd-append.c	Tue May 26 14:21:59 2009 -0400
@@ -44,7 +44,6 @@
 {
 	struct cmd_append_context *ctx = cmd->context;
 	struct client *client = cmd->client;
-	struct ostream *output = client->output;
 	bool finished;
 
 	i_assert(!client->destroyed);
@@ -80,17 +79,19 @@
 		return;
 	}
 
-	o_stream_ref(output);
-	o_stream_cork(output);
+	o_stream_cork(client->output);
 	finished = cmd->func(cmd);
 	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);
+	o_stream_uncork(client->output);
+
+	if (client->disconnected)
+		client_destroy(client, NULL);
+	else
+		client_continue_pending_input(client);
 }
 
 /* Returns -1 = error, 0 = need more data, 1 = successful. flags and