dovecot: Fixed process hanging sometimes when disconnecting.

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 6 02:16:59 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/d747bfbda43c
changeset: 6531:d747bfbda43c
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 06 02:16:56 2007 +0300
description:
Fixed process hanging sometimes when disconnecting.

diffstat:

5 files changed, 12 insertions(+), 8 deletions(-)
src/imap/client.c     |   12 ++++++++----
src/imap/client.h     |    2 +-
src/imap/cmd-append.c |    2 +-
src/imap/cmd-idle.c   |    2 +-
src/imap/cmd-search.c |    2 +-

diffs (82 lines):

diff -r 2f397bc2cc0c -r d747bfbda43c src/imap/client.c
--- a/src/imap/client.c	Sat Oct 06 01:50:52 2007 +0300
+++ b/src/imap/client.c	Sat Oct 06 02:16:56 2007 +0300
@@ -441,14 +441,18 @@ static void client_add_missing_io(struct
 	}
 }
 
-void client_continue_pending_input(struct client *client)
-{
+void client_continue_pending_input(struct client **_client)
+{
+	struct client *client = *_client;
 	size_t size;
 
 	i_assert(!client->handling_input);
 
-	if (client->disconnected)
+	if (client->disconnected) {
+		client_destroy(client, NULL);
+		*_client = NULL;
 		return;
+	}
 
 	if (client->input_lock != NULL) {
 		/* there's a command that has locked the input */
@@ -688,7 +692,7 @@ int client_output(struct client *client)
 		client_destroy(client, NULL);
 		return 1;
 	} else {
-		client_continue_pending_input(client);
+		client_continue_pending_input(&client);
 	}
 	return ret;
 }
diff -r 2f397bc2cc0c -r d747bfbda43c src/imap/client.h
--- a/src/imap/client.h	Sat Oct 06 01:50:52 2007 +0300
+++ b/src/imap/client.h	Sat Oct 06 02:16:56 2007 +0300
@@ -106,7 +106,7 @@ void client_command_cancel(struct client
 void client_command_cancel(struct client_command_context *cmd);
 void client_command_free(struct client_command_context *cmd);
 
-void client_continue_pending_input(struct client *client);
+void client_continue_pending_input(struct client **_client);
 
 void client_input(struct client *client);
 int client_output(struct client *client);
diff -r 2f397bc2cc0c -r d747bfbda43c src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Sat Oct 06 01:50:52 2007 +0300
+++ b/src/imap/cmd-append.c	Sat Oct 06 02:16:56 2007 +0300
@@ -76,7 +76,7 @@ static void client_input_append(struct c
 	if (cmd->func(cmd)) {
 		o_stream_uncork(client->output);
 		client_command_free(cmd);
-		client_continue_pending_input(client);
+		client_continue_pending_input(&client);
 	}
 }
 
diff -r 2f397bc2cc0c -r d747bfbda43c src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c	Sat Oct 06 01:50:52 2007 +0300
+++ b/src/imap/cmd-idle.c	Sat Oct 06 02:16:56 2007 +0300
@@ -55,7 +55,7 @@ idle_finish(struct cmd_idle_context *ctx
 	o_stream_uncork(client->output);
 	if (free_cmd)
 		client_command_free(ctx->cmd);
-	client_continue_pending_input(client);
+	client_continue_pending_input(&client);
 }
 
 static void idle_client_input(struct cmd_idle_context *ctx)
diff -r 2f397bc2cc0c -r d747bfbda43c src/imap/cmd-search.c
--- a/src/imap/cmd-search.c	Sat Oct 06 01:50:52 2007 +0300
+++ b/src/imap/cmd-search.c	Sat Oct 06 02:16:56 2007 +0300
@@ -114,7 +114,7 @@ static void cmd_search_more_callback(str
 
 	if (finished) {
 		client_command_free(cmd);
-		client_continue_pending_input(client);
+		client_continue_pending_input(&client);
 	} else {
 		if (cmd->output_pending)
 			o_stream_set_flush_pending(client->output, TRUE);


More information about the dovecot-cvs mailing list