Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5812:71176467310e HEAD
Fixes to handling command ambiguity. Don't allow any commands that handle
messages be run while mailbox is being synced.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 27 Jun 2007 21:22:22 +0300 |
parents | e0b451e0c190 |
children | 9b4987348cf6 |
files | src/imap/client.c src/imap/client.h src/imap/imap-sync.c |
diffstat | 3 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/client.c Wed Jun 27 20:21:00 2007 +0300 +++ b/src/imap/client.c Wed Jun 27 21:22:22 2007 +0300 @@ -312,8 +312,13 @@ return FALSE; } - if (client_command_find_with_flags(cmd, flags) == NULL) + if (client_command_find_with_flags(cmd, flags) == NULL) { + if (cmd->client->syncing) { + /* don't do anything until syncing is finished */ + return TRUE; + } return FALSE; + } if (broken_client) { client_send_line(cmd->client, @@ -420,6 +425,7 @@ commands to finish. */ if (client_command_check_ambiguity(client->input_lock)) return; + client->input_lock->waiting_unambiguity = FALSE; } client_add_missing_io(client); @@ -522,8 +528,11 @@ { size_t size; - if (client->input_lock != NULL) + if (client->input_lock != NULL) { + if (client->input_lock->waiting_unambiguity) + return FALSE; return client_command_input(client->input_lock); + } if (client->input_skip_line) { /* first eat the previous command line */ @@ -632,9 +641,11 @@ cmd = client->command_queue; for (; cmd != NULL; cmd = next) { next = cmd->next; - client_output_cmd(cmd); - if (client->output_lock != NULL) - break; + if (!cmd->waiting_unambiguity) { + client_output_cmd(cmd); + if (client->output_lock != NULL) + break; + } } } o_stream_uncork(client->output);
--- a/src/imap/client.h Wed Jun 27 20:21:00 2007 +0300 +++ b/src/imap/client.h Wed Jun 27 21:22:22 2007 +0300 @@ -67,6 +67,7 @@ unsigned int destroyed:1; unsigned int handling_input:1; unsigned int idling:1; + unsigned int syncing:1; unsigned int input_skip_line:1; /* skip all the data until we've found a new line */ };
--- a/src/imap/imap-sync.c Wed Jun 27 20:21:00 2007 +0300 +++ b/src/imap/imap-sync.c Wed Jun 27 21:22:22 2007 +0300 @@ -218,6 +218,7 @@ if (ret < 0) ctx->sync_ctx->failed = TRUE; + cmd->client->syncing = FALSE; if (imap_sync_deinit(ctx->sync_ctx) < 0) { client_send_untagged_storage_error(cmd->client, mailbox_get_storage(cmd->client->mailbox)); @@ -263,5 +264,6 @@ if (client->input_lock == cmd) client->input_lock = NULL; client->output_lock = NULL; + client->syncing = TRUE; return cmd_sync_continue(cmd); }