Mercurial > dovecot > original-hg > dovecot-1.2
changeset 939:24b64302f59c HEAD
index_storage_sync_and_lock() didn't set lock notify function.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 10 Jan 2003 13:29:24 +0200 |
parents | 54e2ef691f93 |
children | 65639e7a7cb0 |
files | src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/index-sync.c |
diffstat | 3 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-storage.c Fri Jan 10 13:22:50 2003 +0200 +++ b/src/lib-storage/index/index-storage.c Fri Jan 10 13:29:24 2003 +0200 @@ -185,16 +185,20 @@ } } +void index_storage_init_lock_notify(struct index_mailbox *ibox) +{ + ibox->next_lock_notify = time(NULL) + LOCK_NOTIFY_INTERVAL; + ibox->index->set_lock_notify_callback(ibox->index, lock_notify, ibox); +} + int index_storage_lock(struct index_mailbox *ibox, enum mail_lock_type lock_type) { int ret; - ibox->next_lock_notify = time(NULL) + LOCK_NOTIFY_INTERVAL; - /* we have to set/reset this every time, because the same index may be used by multiple IndexMailboxes. */ - ibox->index->set_lock_notify_callback(ibox->index, lock_notify, ibox); + index_storage_init_lock_notify(ibox); ret = ibox->index->set_lock(ibox->index, lock_type); ibox->index->set_lock_notify_callback(ibox->index, NULL, NULL);
--- a/src/lib-storage/index/index-storage.h Fri Jan 10 13:22:50 2003 +0200 +++ b/src/lib-storage/index/index-storage.h Fri Jan 10 13:29:24 2003 +0200 @@ -31,6 +31,7 @@ extern struct imap_message_cache_iface index_msgcache_iface; int mail_storage_set_index_error(struct index_mailbox *ibox); +void index_storage_init_lock_notify(struct index_mailbox *ibox); int index_storage_lock(struct index_mailbox *ibox, enum mail_lock_type lock_type);
--- a/src/lib-storage/index/index-sync.c Fri Jan 10 13:22:50 2003 +0200 +++ b/src/lib-storage/index/index-sync.c Fri Jan 10 13:29:24 2003 +0200 @@ -34,11 +34,15 @@ { struct mail_storage *storage = ibox->box.storage; struct mail_index *index = ibox->index; - int changes, set_shared_lock; + int failed, changes, set_shared_lock; set_shared_lock = ibox->index->lock_type != MAIL_LOCK_EXCLUSIVE; - if (index->sync_and_lock(index, data_lock_type, &changes)) { + index_storage_init_lock_notify(ibox); + failed = !index->sync_and_lock(index, data_lock_type, &changes); + ibox->index->set_lock_notify_callback(ibox->index, NULL, NULL); + + if (!failed) { /* reset every time it has worked */ ibox->sent_diskspace_warning = FALSE; } else {