[dovecot-cvs] dovecot/src/lib-storage/index/cydir cydir-sync.c, 1.3, 1.4

tss at dovecot.org tss at dovecot.org
Tue Apr 17 18:09:14 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/cydir
In directory talvi:/tmp/cvs-serv29199/index/cydir

Modified Files:
	cydir-sync.c 
Log Message:
Call sync_notify() once at the end of syncing. Allow accessing mails even
while syncing, as long as it's safe to do so.



Index: cydir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/cydir/cydir-sync.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cydir-sync.c	17 Apr 2007 12:41:27 -0000	1.3
+++ cydir-sync.c	17 Apr 2007 15:09:12 -0000	1.4
@@ -73,10 +73,11 @@
 
 static int cydir_sync_index(struct cydir_sync_context *ctx)
 {
+	struct mailbox *box = &ctx->mbox->ibox.box;
 	const struct mail_index_header *hdr;
 	struct mail_index_sync_rec sync_rec;
 	uint32_t seq1, seq2;
-	int ret;
+	int ret = 1;
 
 	hdr = mail_index_get_header(ctx->sync_view);
 	if (hdr->uid_validity == 0) {
@@ -84,7 +85,8 @@
 			return -1;
 	}
 
-	while ((ret = mail_index_sync_next(ctx->index_sync_ctx,
+	while (ret > 0 &&
+	       (ret = mail_index_sync_next(ctx->index_sync_ctx,
 					   &sync_rec)) > 0) {
 		if (mail_index_lookup_uid_range(ctx->sync_view,
 						sync_rec.uid1, sync_rec.uid2,
@@ -103,7 +105,7 @@
 			break;
 		case MAIL_INDEX_SYNC_TYPE_EXPUNGE:
 			if (cydir_sync_expunge(ctx, seq1, seq2) < 0)
-				return -1;
+				ret = -1;
 			break;
 		case MAIL_INDEX_SYNC_TYPE_FLAGS:
 		case MAIL_INDEX_SYNC_TYPE_KEYWORD_ADD:
@@ -113,7 +115,10 @@
 			break;
 		}
 	}
-	return 0;
+
+	if (box->v.sync_notify != NULL)
+		box->v.sync_notify(box, 0, 0);
+	return ret;
 }
 
 int cydir_sync_begin(struct cydir_mailbox *mbox,



More information about the dovecot-cvs mailing list