dovecot: Don't update maildir sync header if only sync time has ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 19 03:51:37 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/d5d3adb86e12
changeset: 6097:d5d3adb86e12
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 19 03:51:31 2007 +0300
description:
Don't update maildir sync header if only sync time has changed, and that
hasn't changed delayed-refresh state.
diffstat:
1 file changed, 21 insertions(+), 1 deletion(-)
src/lib-storage/index/maildir/maildir-sync-index.c | 22 +++++++++++++++++++-
diffs (39 lines):
diff -r 877d861f2dd3 -r d5d3adb86e12 src/lib-storage/index/maildir/maildir-sync-index.c
--- a/src/lib-storage/index/maildir/maildir-sync-index.c Thu Jul 19 03:37:43 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync-index.c Thu Jul 19 03:51:31 2007 +0300
@@ -219,6 +219,26 @@ int maildir_sync_index_finish(struct mai
return ret;
}
+static bool
+maildir_index_header_has_changed(const struct maildir_index_header *old_hdr,
+ const struct maildir_index_header *new_hdr)
+{
+#define DIR_DELAYED_REFRESH(hdr, name) \
+ ((hdr)->name ## _check_time <= \
+ (hdr)->name ## _mtime + MAILDIR_SYNC_SECS)
+
+ if (old_hdr->new_mtime != new_hdr->new_mtime ||
+ old_hdr->cur_mtime != new_hdr->cur_mtime ||
+ old_hdr->new_mtime_nsecs != new_hdr->new_mtime_nsecs ||
+ old_hdr->cur_mtime_nsecs != new_hdr->cur_mtime_nsecs)
+ return TRUE;
+
+ return DIR_DELAYED_REFRESH(old_hdr, new) !=
+ DIR_DELAYED_REFRESH(new_hdr, new) ||
+ DIR_DELAYED_REFRESH(old_hdr, cur) !=
+ DIR_DELAYED_REFRESH(new_hdr, cur);
+}
+
static void
maildir_index_update_ext_header(struct maildir_mailbox *mbox,
struct mail_index_transaction *trans)
@@ -231,7 +251,7 @@ maildir_index_update_ext_header(struct m
data_size = 0;
if (data_size == sizeof(mbox->maildir_hdr) &&
- memcmp(data, &mbox->maildir_hdr, data_size) == 0) {
+ !maildir_index_header_has_changed(data, &mbox->maildir_hdr)) {
/* nothing changed */
} else {
mail_index_update_header_ext(trans, mbox->maildir_ext_id, 0,
More information about the dovecot-cvs
mailing list