]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Changed the way mailbox changing ambiguity is checked.
authorTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 12:43:12 +0000 (15:43 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 12:43:12 +0000 (15:43 +0300)
--HG--
branch : HEAD

src/imap/client.c
src/imap/client.h
src/imap/cmd-close.c
src/imap/cmd-select.c
src/imap/cmd-unselect.c

index d80b01b5d4a5b55870c13e9486bba4df541d919a..c9b471d56d5fa931329c11d60067b4537264bbff 100644 (file)
@@ -401,7 +401,8 @@ static bool client_command_check_ambiguity(struct client_command_context *cmd)
                        /* 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_command_context **_cmd)
                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);
index 8dcb4b026c2c37994d623797df4711ca6d35adb0..644448f47f782fb1fb6f9758223c84bd957cebe9 100644 (file)
@@ -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;
index 56d2dd3ffb97736d915b398d8d2861f81b8be89d..a850819659f7dbbb17b8788319e936e5e5fd4365 100644 (file)
@@ -12,7 +12,6 @@ static void cmd_close_finish(struct client *client)
                        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_context *cmd)
        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)
index 67ff06c18e35f7bbc9b57549d3e8f6799c93b028..597cfdf3d3de92a583b47ea11fb53692c1e3e756 100644 (file)
@@ -195,7 +195,6 @@ static void cmd_select_finish(struct imap_select_context *ctx, int ret)
                                    "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_command_context *cmd, bool readonly)
                }
        }
 
-       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);
index 5ab2101ee1e9f9d0030758a437a9c767ceddcc65..3b4b18ad0ded529085f64fd701e2f54c8fcd3d40 100644 (file)
@@ -14,7 +14,7 @@ bool cmd_unselect(struct client_command_context *cmd)
 
        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);