dovecot: Replaced waiting_ambiguity bitmask with a command state.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jan 12 08:51:21 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/323b425a0f46
changeset: 7149:323b425a0f46
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jan 12 06:56:16 2008 +0200
description:
Replaced waiting_ambiguity bitmask with a command state.

diffstat:

3 files changed, 11 insertions(+), 12 deletions(-)
src/imap/client.c   |   15 ++++++++-------
src/imap/client.h   |    6 ++----
src/imap/cmd-idle.c |    2 +-

diffs (79 lines):

diff -r 5e3188213724 -r 323b425a0f46 src/imap/client.c
--- a/src/imap/client.c	Sat Jan 12 06:46:28 2008 +0200
+++ b/src/imap/client.c	Sat Jan 12 06:56:16 2008 +0200
@@ -472,15 +472,16 @@ void client_continue_pending_input(struc
 
 	if (client->input_lock != NULL) {
 		/* there's a command that has locked the input */
-		if (!client->input_lock->waiting_unambiguity)
+		struct client_command_context *cmd = client->input_lock;
+
+		if (cmd->state != CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY)
 			return;
 
 		/* the command is waiting for existing ambiguity causing
 		   commands to finish. */
-		if (client_command_check_ambiguity(client->input_lock))
+		if (client_command_check_ambiguity(cmd))
 			return;
-		client->input_lock->waiting_unambiguity = FALSE;
-		client->input_lock->state = CLIENT_COMMAND_STATE_WAIT_INPUT;
+		cmd->state = CLIENT_COMMAND_STATE_WAIT_INPUT;
 	}
 
 	client_add_missing_io(client);
@@ -575,8 +576,7 @@ static bool client_command_input(struct 
 		if (client_command_check_ambiguity(cmd)) {
 			/* do nothing until existing commands are finished */
 			i_assert(cmd->state == CLIENT_COMMAND_STATE_WAIT_INPUT);
-			cmd->waiting_unambiguity = TRUE;
-			cmd->state = CLIENT_COMMAND_STATE_WAIT;
+			cmd->state = CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY;
 			io_remove(&client->io);
 			return FALSE;
 		}
@@ -602,7 +602,8 @@ static int client_handle_next_command(st
 	*remove_io_r = FALSE;
 
 	if (client->input_lock != NULL) {
-		if (client->input_lock->waiting_unambiguity) {
+		if (client->input_lock->state ==
+		    CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY) {
 			*remove_io_r = TRUE;
 			return FALSE;
 		}
diff -r 5e3188213724 -r 323b425a0f46 src/imap/client.h
--- a/src/imap/client.h	Sat Jan 12 06:46:28 2008 +0200
+++ b/src/imap/client.h	Sat Jan 12 06:56:16 2008 +0200
@@ -25,9 +25,8 @@ enum client_command_state {
 	CLIENT_COMMAND_STATE_WAIT_INPUT,
 	/* Waiting to be able to send more output */
 	CLIENT_COMMAND_STATE_WAIT_OUTPUT,
-	/* Just waiting for execution to continue later. For example waiting
-	   for other commands to finish first. */
-	CLIENT_COMMAND_STATE_WAIT,
+	/* Wait for other commands to finish execution */
+	CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY,
 	/* Command is finished */
 	CLIENT_COMMAND_STATE_DONE
 };
@@ -50,7 +49,6 @@ struct client_command_context {
 	unsigned int uid:1; /* used UID command */
 	unsigned int cancel:1; /* command is wanted to be cancelled */
 	unsigned int param_error:1;
-	unsigned int waiting_unambiguity:1;
 };
 
 struct client {
diff -r 5e3188213724 -r 323b425a0f46 src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c	Sat Jan 12 06:46:28 2008 +0200
+++ b/src/imap/cmd-idle.c	Sat Jan 12 06:56:16 2008 +0200
@@ -171,7 +171,7 @@ static bool cmd_idle_continue(struct cli
 		   so we return here instead of doing everything twice. */
 		return FALSE;
 	}
-	cmd->state = CLIENT_COMMAND_STATE_WAIT;
+	cmd->state = CLIENT_COMMAND_STATE_WAIT_INPUT;
 
 	if (ctx->manual_cork) {
 		ctx->manual_cork = FALSE;


More information about the dovecot-cvs mailing list