dovecot-2.1: imapc: Fixed error handling while opening mailbox.
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 4 12:03:22 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/0b786a676453
changeset: 13380:0b786a676453
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 04 12:03:12 2011 +0300
description:
imapc: Fixed error handling while opening mailbox.
diffstat:
src/lib-storage/index/imapc/imapc-mailbox.c | 11 +++++++----
src/lib-storage/index/imapc/imapc-storage.c | 2 +-
src/lib-storage/index/imapc/imapc-storage.h | 1 +
3 files changed, 9 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 7b240ecc37b5 -r 0b786a676453 src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c Sun Sep 04 11:52:16 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c Sun Sep 04 12:03:12 2011 +0300
@@ -90,16 +90,19 @@
struct imapc_mailbox *mbox = context;
if (reply->state == IMAPC_COMMAND_STATE_OK)
- ;
+ mbox->open_success = TRUE;
else if (reply->state == IMAPC_COMMAND_STATE_NO) {
imapc_copy_error_from_reply(mbox->storage, MAIL_ERROR_PARAMS,
reply);
- } else {
+ } else if (mbox->opening ||
+ reply->state != IMAPC_COMMAND_STATE_DISCONNECTED) {
mail_storage_set_critical(&mbox->storage->storage,
- "imapc: Command failed: %s", reply->text_full);
+ "imapc: Mailbox newmsgs fetch failed: %s",
+ reply->text_full);
}
if (mbox->opening) {
- imapc_mailbox_open_finish(mbox);
+ if (reply->state == IMAPC_COMMAND_STATE_OK)
+ imapc_mailbox_open_finish(mbox);
imapc_client_stop(mbox->storage->client);
}
}
diff -r 7b240ecc37b5 -r 0b786a676453 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c Sun Sep 04 11:52:16 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-storage.c Sun Sep 04 12:03:12 2011 +0300
@@ -335,7 +335,7 @@
while (ctx.ret == -2)
imapc_client_run(mbox->storage->client);
mbox->opening = FALSE;
- if (ctx.ret < 0) {
+ if (!mbox->open_success) {
mailbox_close(box);
return -1;
}
diff -r 7b240ecc37b5 -r 0b786a676453 src/lib-storage/index/imapc/imapc-storage.h
--- a/src/lib-storage/index/imapc/imapc-storage.h Sun Sep 04 11:52:16 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-storage.h Sun Sep 04 12:03:12 2011 +0300
@@ -57,6 +57,7 @@
uint32_t highest_seen_uid;
unsigned int opening:1;
+ unsigned int open_success:1;
unsigned int new_msgs:1;
};
More information about the dovecot-cvs
mailing list