dovecot-2.2: lib-index: Transaction view shouldn't return ext re...

dovecot at dovecot.org dovecot at dovecot.org
Sat Nov 3 19:26:22 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/148dc0f6f990
changeset: 15370:148dc0f6f990
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Nov 03 19:13:24 2012 +0200
description:
lib-index: Transaction view shouldn't return ext records if the ext was already reset.

diffstat:

 src/lib-index/mail-index-transaction-view.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 899873ebc1cf -r 148dc0f6f990 src/lib-index/mail-index-transaction-view.c
--- a/src/lib-index/mail-index-transaction-view.c	Sat Nov 03 18:43:00 2012 +0200
+++ b/src/lib-index/mail-index-transaction-view.c	Sat Nov 03 19:13:24 2012 +0200
@@ -381,6 +381,19 @@
 	}
 }
 
+static bool
+tview_is_ext_reset(struct mail_index_view_transaction *tview, uint32_t ext_id)
+{
+	const struct mail_transaction_ext_reset *resets;
+	unsigned int count;
+
+	if (!array_is_created(&tview->t->ext_resets))
+		return FALSE;
+
+	resets = array_get(&tview->t->ext_resets, &count);
+	return ext_id < count && resets[ext_id].new_reset_id != 0;
+}
+
 static void
 tview_lookup_ext_full(struct mail_index_view *view, uint32_t seq,
 		      uint32_t ext_id, struct mail_index_map **map_r,
@@ -411,8 +424,10 @@
 		}
 	}
 
-	/* not updated, return the existing value */
-	if (seq < tview->t->first_new_seq) {
+	/* not updated, return the existing value, unless ext was
+	   already reset */
+	if (seq < tview->t->first_new_seq &&
+	    !tview_is_ext_reset(tview, ext_id)) {
 		tview->super->lookup_ext_full(view, seq, ext_id,
 					      map_r, data_r, expunged_r);
 	} else {


More information about the dovecot-cvs mailing list