changeset 5004:13db2cd1ae94 HEAD

We could have synced external transactions multiple times, causing corrupted view errors.
author Timo Sirainen <tss@iki.fi>
date Sun, 14 Jan 2007 06:01:31 +0200
parents 327d82f579a2
children 7a8f68b0cc31
files src/lib-index/mail-index-view-sync.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-view-sync.c	Sun Jan 14 05:37:17 2007 +0200
+++ b/src/lib-index/mail-index-view-sync.c	Sun Jan 14 06:01:31 2007 +0200
@@ -192,7 +192,6 @@
                                enum mail_index_sync_type sync_mask,
 			       struct mail_index_view_sync_ctx **ctx_r)
 {
-	const struct mail_index_header *hdr;
 	struct mail_index_view_sync_ctx *ctx;
 	struct mail_index_map *map;
 	enum mail_transaction_type log_get_mask, visible_mask;
@@ -212,7 +211,6 @@
 	if (mail_index_view_lock_head(view, TRUE) < 0)
 		return -1;
 
-	hdr = view->index->hdr;
 	if ((sync_mask & MAIL_INDEX_SYNC_TYPE_EXPUNGE) != 0) {
 		/* get list of all expunges first */
 		if (view_sync_get_expunges(view, &expunges) < 0)
@@ -370,6 +368,13 @@
 		}
 
 		/* skip everything we've already synced */
+		if (offset < view->hdr.log_file_ext_offset &&
+		    seq == view->hdr.log_file_seq &&
+		    (ctx->hdr->type & MAIL_TRANSACTION_EXTERNAL) != 0) {
+			/* view->log_file_offset contains the minimum of
+			   int/ext offsets. */
+			continue;
+		}
 		if (view_sync_pos_find(&view->syncs_done, seq, offset))
 			continue;