Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-storage/index/cydir/cydir-sync.c @ 5564:47274663a71c HEAD
Call sync_notify() once at the end of syncing. Allow accessing mails even
while syncing, as long as it's safe to do so.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 17 Apr 2007 18:09:10 +0300 |
parents | 24b751bc0995 |
children | 453128e12b11 |
line wrap: on
line diff
--- a/src/lib-storage/index/cydir/cydir-sync.c Tue Apr 17 17:07:08 2007 +0300 +++ b/src/lib-storage/index/cydir/cydir-sync.c Tue Apr 17 18:09:10 2007 +0300 @@ -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,