dovecot-1.2: Changed the way mailbox changing ambiguity is checked.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 11 15:45:04 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/ea6727a1220e
changeset: 7816:ea6727a1220e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 11 15:43:12 2008 +0300
description:
Changed the way mailbox changing ambiguity is checked.

diffstat:

5 files changed, 11 insertions(+), 9 deletions(-)
src/imap/client.c       |    5 ++++-
src/imap/client.h       |    3 ++-
src/imap/cmd-close.c    |    5 ++---
src/imap/cmd-select.c   |    5 ++---
src/imap/cmd-unselect.c |    2 +-

diffs (98 lines):

diff -r 2d62129a709b -r ea6727a1220e src/imap/client.c
--- a/src/imap/client.c	Wed Jun 11 14:39:52 2008 +0300
+++ b/src/imap/client.c	Wed Jun 11 15:43:12 2008 +0300
@@ -401,7 +401,8 @@ static bool client_command_check_ambigui
 			/* don't do anything until syncing is finished */
 			return TRUE;
 		}
-		if (cmd->client->changing_mailbox) {
+		if (cmd->client->mailbox_change_lock != NULL &&
+		    cmd->client->mailbox_change_lock != cmd) {
 			/* don't do anything until mailbox is fully
 			   opened/closed */
 			return TRUE;
@@ -464,6 +465,8 @@ void client_command_free(struct client_c
 		client->input_lock = NULL;
 	if (client->output_lock == cmd)
 		client->output_lock = NULL;
+	if (client->mailbox_change_lock == cmd)
+		client->mailbox_change_lock = NULL;
 
 	if (client->free_parser != NULL)
 		imap_parser_destroy(&cmd->parser);
diff -r 2d62129a709b -r ea6727a1220e src/imap/client.h
--- a/src/imap/client.h	Wed Jun 11 14:39:52 2008 +0300
+++ b/src/imap/client.h	Wed Jun 11 15:43:12 2008 +0300
@@ -103,6 +103,8 @@ struct client {
 	/* client input/output is locked by this command */
 	struct client_command_context *input_lock;
 	struct client_command_context *output_lock;
+	/* command changing the mailbox */
+	struct client_command_context *mailbox_change_lock;
 
 	/* syncing marks this TRUE when it sees \Deleted flags. this is by
 	   EXPUNGE for Outlook-workaround. */
@@ -112,7 +114,6 @@ struct client {
 	unsigned int destroyed:1;
 	unsigned int handling_input:1;
 	unsigned int syncing:1;
-	unsigned int changing_mailbox:1;
 	unsigned int input_skip_line:1; /* skip all the data until we've
 					   found a new line */
 	unsigned int modseqs_sent_since_sync:1;
diff -r 2d62129a709b -r ea6727a1220e src/imap/cmd-close.c
--- a/src/imap/cmd-close.c	Wed Jun 11 14:39:52 2008 +0300
+++ b/src/imap/cmd-close.c	Wed Jun 11 15:43:12 2008 +0300
@@ -12,7 +12,6 @@ static void cmd_close_finish(struct clie
 			mailbox_get_storage(client->mailbox));
 	}
 	client_update_mailbox_flags(client, NULL);
-	client->changing_mailbox = FALSE;
 }
 
 static bool cmd_close_callback(struct client_command_context *cmd)
@@ -38,8 +37,8 @@ bool cmd_close(struct client_command_con
 	if (!client_verify_open_mailbox(cmd))
 		return TRUE;
 
-	i_assert(!client->changing_mailbox);
-	client->changing_mailbox = TRUE;
+	i_assert(client->mailbox_change_lock == NULL);
+	client->mailbox_change_lock = cmd;
 
 	storage = mailbox_get_storage(mailbox);
 	if ((ret = imap_expunge(mailbox, NULL)) < 0)
diff -r 2d62129a709b -r ea6727a1220e src/imap/cmd-select.c
--- a/src/imap/cmd-select.c	Wed Jun 11 14:39:52 2008 +0300
+++ b/src/imap/cmd-select.c	Wed Jun 11 15:43:12 2008 +0300
@@ -195,7 +195,6 @@ static void cmd_select_finish(struct ima
 				    "OK [READ-ONLY] Select completed." :
 				    "OK [READ-WRITE] Select completed.");
 	}
-	ctx->cmd->client->changing_mailbox = FALSE;
 	select_context_free(ctx);
 }
 
@@ -355,8 +354,8 @@ bool cmd_select_full(struct client_comma
 		}
 	}
 
-	i_assert(!client->changing_mailbox);
-	client->changing_mailbox = TRUE;
+	i_assert(client->mailbox_change_lock == NULL);
+	client->mailbox_change_lock = cmd;
 
 	if (client->mailbox != NULL) {
 		client_search_updates_free(client);
diff -r 2d62129a709b -r ea6727a1220e src/imap/cmd-unselect.c
--- a/src/imap/cmd-unselect.c	Wed Jun 11 14:39:52 2008 +0300
+++ b/src/imap/cmd-unselect.c	Wed Jun 11 15:43:12 2008 +0300
@@ -14,7 +14,7 @@ bool cmd_unselect(struct client_command_
 
 	client_search_updates_free(client);
 
-	i_assert(!client->changing_mailbox);
+	i_assert(client->mailbox_change_lock == NULL);
 	client->mailbox = NULL;
 
 	storage = mailbox_get_storage(mailbox);


More information about the dovecot-cvs mailing list