[dovecot-cvs] dovecot/src/lib-storage/index index-storage.c,1.24,1.25 index-storage.h,1.27,1.28 index-sync.c,1.22,1.23

cras at procontrol.fi cras at procontrol.fi
Fri Jan 10 13:29:26 EET 2003


Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv4025/lib-storage/index

Modified Files:
	index-storage.c index-storage.h index-sync.c 
Log Message:
index_storage_sync_and_lock() didn't set lock notify function.



Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- index-storage.c	5 Jan 2003 13:09:52 -0000	1.24
+++ index-storage.c	10 Jan 2003 11:29:24 -0000	1.25
@@ -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);
 

Index: index-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- index-storage.h	8 Jan 2003 20:49:52 -0000	1.27
+++ index-storage.h	10 Jan 2003 11:29:24 -0000	1.28
@@ -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);
 

Index: index-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sync.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- index-sync.c	5 Jan 2003 13:09:52 -0000	1.22
+++ index-sync.c	10 Jan 2003 11:29:24 -0000	1.23
@@ -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 {




More information about the dovecot-cvs mailing list