dovecot-2.1: imapc: Never use box->view for syncing related purp...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 4 13:20:58 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/5dac75d12c59
changeset: 13385:5dac75d12c59
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 04 13:20:27 2011 +0300
description:
imapc: Never use box->view for syncing related purposes.
The view isn't up to date when MAILBOX_SYNC_FLAG_NO_EXPUNGES is used to sync
it. Instead always use a separate sync view.
diffstat:
src/lib-storage/index/imapc/imapc-mailbox.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (54 lines):
diff -r 33dc66d4286d -r 5dac75d12c59 src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c Sun Sep 04 12:38:24 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c Sun Sep 04 13:20:27 2011 +0300
@@ -26,14 +26,21 @@
imapc_client_mailbox_disconnect(mbox->client_box);
}
+static struct mail_index_view *
+imapc_mailbox_get_sync_view(struct imapc_mailbox *mbox)
+{
+ if (mbox->sync_view == NULL)
+ mbox->sync_view = mail_index_view_open(mbox->box.index);
+ return mbox->sync_view;
+}
+
static void imapc_mailbox_init_delayed_trans(struct imapc_mailbox *mbox)
{
if (mbox->delayed_sync_trans != NULL)
return;
- mbox->sync_view = mail_index_view_open(mbox->box.index);
mbox->delayed_sync_trans =
- mail_index_transaction_begin(mbox->sync_view,
+ mail_index_transaction_begin(imapc_mailbox_get_sync_view(mbox),
MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);
mbox->delayed_sync_view =
mail_index_transaction_open_updated_view(mbox->delayed_sync_trans);
@@ -120,7 +127,7 @@
return;
if (view == NULL)
- view = mbox->box.view;
+ view = imapc_mailbox_get_sync_view(mbox);
if (rcount == 0) {
/* nothing in this mailbox */
@@ -356,7 +363,7 @@
str_to_uint32(reply->resp_text_value, &uid_validity) < 0)
return;
- hdr = mail_index_get_header(mbox->box.view);
+ hdr = mail_index_get_header(imapc_mailbox_get_sync_view(mbox));
if (hdr->uid_validity != uid_validity) {
imapc_mailbox_init_delayed_trans(mbox);
if (hdr->uid_validity != 0) {
@@ -382,7 +389,7 @@
str_to_uint32(reply->resp_text_value, &uid_next) < 0)
return;
- hdr = mail_index_get_header(mbox->box.view);
+ hdr = mail_index_get_header(imapc_mailbox_get_sync_view(mbox));
if (hdr->next_uid != uid_next) {
imapc_mailbox_init_delayed_trans(mbox);
mail_index_update_header(mbox->delayed_sync_trans,
More information about the dovecot-cvs
mailing list