dovecot: Assert-crashfixes to handling non-external expunges (br...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 15 19:25:24 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/bf9f97c09250
changeset: 5744:bf9f97c09250
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 15 19:25:20 2007 +0300
description:
Assert-crashfixes to handling non-external expunges (broken by last changes)

diffstat:

1 file changed, 23 insertions(+), 3 deletions(-)
src/lib-index/mail-index-view-sync.c |   26 +++++++++++++++++++++++---

diffs (50 lines):

diff -r 1fa32e040ea5 -r bf9f97c09250 src/lib-index/mail-index-view-sync.c
--- a/src/lib-index/mail-index-view-sync.c	Fri Jun 15 18:09:09 2007 +0300
+++ b/src/lib-index/mail-index-view-sync.c	Fri Jun 15 19:25:20 2007 +0300
@@ -412,6 +412,26 @@ static bool view_sync_area_find(ARRAY_TY
 	return FALSE;
 }
 
+static bool
+mail_index_view_sync_skip(struct mail_index_view_sync_ctx *ctx,
+			  const struct mail_transaction_header *hdr)
+{
+	if ((hdr->type & ctx->visible_sync_mask) != 0)
+		return FALSE;
+
+	if ((hdr->type & MAIL_TRANSACTION_VISIBLE_SYNC_MASK) == 0)
+		return FALSE;
+
+	if ((hdr->type & MAIL_TRANSACTION_EXPUNGE) != 0 &&
+	    (hdr->type & MAIL_TRANSACTION_EXTERNAL) == 0) {
+		/* expunge request. this will be ignored */
+		return FALSE;
+	}
+
+	/* visible record that we want to skip */
+	return TRUE;
+}
+
 static int
 mail_index_view_sync_get_next_transaction(struct mail_index_view_sync_ctx *ctx)
 {
@@ -437,8 +457,7 @@ mail_index_view_sync_get_next_transactio
 		}
 
 		hdr = ctx->hdr;
-		if ((hdr->type & ctx->visible_sync_mask) == 0 &&
-		    (hdr->type & MAIL_TRANSACTION_VISIBLE_SYNC_MASK) != 0) {
+		if (mail_index_view_sync_skip(ctx, hdr)) {
 			/* This is a visible record that we don't want to
 			   sync. */
 			ctx->skipped_some = TRUE;
@@ -479,7 +498,8 @@ mail_index_view_sync_get_next_transactio
 		/* Apply transaction to view's mapping if needed (meaning we
 		   didn't just re-map the view to head mapping). */
 		if (ctx->sync_map_update && !synced_to_map) {
-			i_assert((hdr->type & MAIL_TRANSACTION_EXPUNGE) == 0);
+			i_assert((hdr->type & MAIL_TRANSACTION_EXPUNGE) == 0 ||
+				 (hdr->type & MAIL_TRANSACTION_EXTERNAL) == 0);
 
 			if (mail_index_sync_record(&ctx->sync_map_ctx,
 						   hdr, ctx->data) < 0)


More information about the dovecot-cvs mailing list