changeset 7149:323b425a0f46 HEAD

Replaced waiting_ambiguity bitmask with a command state.
author Timo Sirainen <tss@iki.fi>
date Sat, 12 Jan 2008 06:56:16 +0200
parents 5e3188213724
children 8a531386c856
files src/imap/client.c src/imap/client.h src/imap/cmd-idle.c
diffstat 3 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 
 	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 @@
 		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 @@
 	*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;
 		}
--- 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 @@
 	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 @@
 	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 {
--- 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 @@
 		   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;