[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c,
1.23, 1.24
cras at procontrol.fi
cras at procontrol.fi
Wed May 26 02:16:13 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-lock.c, 1.18,
1.19 mail-index-private.h, 1.15, 1.16 mail-index.c, 1.125,
1.126 mail-index.h, 1.111, 1.112
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-view.c,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv20277/lib-storage/index/maildir
Modified Files:
maildir-sync.c
Log Message:
Don't use internal last_cur_mtime stamp - it's index-specific so always get
it from index's header.
Index: maildir-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- a/maildir-sync.c 24 May 2004 02:47:23 -0000 1.23
+++ b/maildir-sync.c 25 May 2004 23:16:11 -0000 1.24
@@ -513,7 +513,6 @@
static int maildir_sync_quick_check(struct maildir_sync_context *ctx,
int *new_changed_r, int *cur_changed_r)
{
- const struct mail_index_header *hdr;
struct index_mailbox *ibox = ctx->ibox;
struct stat st;
time_t new_mtime, cur_mtime;
@@ -534,10 +533,26 @@
}
cur_mtime = st.st_mtime;
- if (ibox->last_cur_mtime == 0) {
- /* first sync in this session, get cur stamp from index */
- if (mail_index_get_header(ibox->view, &hdr) == 0)
- ibox->last_cur_mtime = hdr->sync_stamp;
+ if (ibox->dirty_cur_time == 0) {
+ /* cur stamp is kept in index, we don't have to sync if
+ someone else has done it and updated the index. make sure
+ we have a fresh index with latest sync_stamp. */
+ struct mail_index_view *view;
+ const struct mail_index_header *hdr;
+
+ if (mail_index_refresh(ibox->index) < 0) {
+ mail_storage_set_index_error(ibox);
+ return -1;
+ }
+
+ view = mail_index_view_open(ibox->index);
+ if (mail_index_get_header(view, &hdr) < 0) {
+ mail_index_view_close(view);
+ mail_storage_set_index_error(ibox);
+ return -1;
+ }
+ ibox->last_cur_mtime = hdr->sync_stamp;
+ mail_index_view_close(view);
}
if (new_mtime != ibox->last_new_mtime ||
@@ -690,7 +705,7 @@
mail_index_mark_corrupted(ibox->index);
ret = -1;
break;
- }
+ }
ibox->dirty_cur_time = ioloop_time;
maildir_uidlist_add_flags(ibox->uidlist, filename,
@@ -740,7 +755,8 @@
}
}
- if (ibox->dirty_cur_time == 0) {
+ if (ibox->dirty_cur_time == 0 &&
+ ibox->last_cur_mtime != (time_t)hdr->sync_stamp) {
uint32_t sync_stamp = ibox->last_cur_mtime;
mail_index_update_header(trans,
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-lock.c, 1.18,
1.19 mail-index-private.h, 1.15, 1.16 mail-index.c, 1.125,
1.126 mail-index.h, 1.111, 1.112
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-view.c,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list