# HG changeset patch # User Timo Sirainen # Date 1042198164 -7200 # Node ID 24b64302f59ce894eaeb1adf2063570f7037065c # Parent 54e2ef691f93f9bd41ffd108f730f1643ac1534f index_storage_sync_and_lock() didn't set lock notify function. diff -r 54e2ef691f93 -r 24b64302f59c src/lib-storage/index/index-storage.c --- 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); diff -r 54e2ef691f93 -r 24b64302f59c src/lib-storage/index/index-storage.h --- 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); diff -r 54e2ef691f93 -r 24b64302f59c src/lib-storage/index/index-sync.c --- 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 {