dovecot-2.2: imap: IDLE may have called client_continue_pending_...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 24 12:47:54 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/20e51832875e
changeset: 19414:20e51832875e
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 24 13:40:12 2015 +0200
description:
imap: IDLE may have called client_continue_pending_input() unnecessarily.

diffstat:

 src/imap/cmd-idle.c |  25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diffs (66 lines):

diff -r 8d9b48c59490 -r 20e51832875e src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c	Tue Nov 24 12:56:35 2015 +0200
+++ b/src/imap/cmd-idle.c	Tue Nov 24 13:40:12 2015 +0200
@@ -72,7 +72,7 @@
 	return FALSE;
 }
 
-static void idle_client_input_more(struct cmd_idle_context *ctx)
+static bool idle_client_input_more(struct cmd_idle_context *ctx)
 {
 	struct client *client = ctx->client;
 
@@ -83,34 +83,33 @@
 	case -1:
 		/* disconnected */
 		client_disconnect(client, NULL);
-		return;
+		return TRUE;
 	case -2:
 		client->input_skip_line = TRUE;
 		idle_finish(ctx, FALSE, TRUE);
-		client_continue_pending_input(client);
-		return;
+		return TRUE;
 	}
 
 	if (ctx->sync_ctx != NULL) {
 		/* we're still sending output to client. wait until it's all
 		   sent so we don't lose any changes. */
 		io_remove(&client->io);
-		return;
+		return FALSE;
 	}
 
-	if (idle_client_handle_input(ctx, TRUE)) {
-		if (!client->disconnected)
-			client_continue_pending_input(client);
-	}
+	return idle_client_handle_input(ctx, TRUE);
 }
 
 static void idle_client_input(struct cmd_idle_context *ctx)
 {
 	struct client *client = ctx->client;
 
-	idle_client_input_more(ctx);
-	if (client->disconnected)
-		client_destroy(client, NULL);
+	if (idle_client_input_more(ctx)) {
+		if (client->disconnected)
+			client_destroy(client, NULL);
+		else
+			client_continue_pending_input(client);
+	}
 }
 
 static void keepalive_timeout(struct cmd_idle_context *ctx)
@@ -271,7 +270,7 @@
 		/* input is pending */
 		client->io = io_add_istream(client->input,
 					    idle_client_input, ctx);
-		idle_client_input_more(ctx);
+		(void)idle_client_input_more(ctx);
 	}
 	return FALSE;
 }


More information about the dovecot-cvs mailing list