[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.34, 1.35 dbox-storage.h, 1.16, 1.17 dbox-uidlist.c, 1.43, 1.44 dbox-uidlist.h, 1.8, 1.9

tss at dovecot.org tss at dovecot.org
Thu Feb 22 12:50:20 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv11392/dbox

Modified Files:
	dbox-storage.c dbox-storage.h dbox-uidlist.c dbox-uidlist.h 
Log Message:
If pop3_lock_session=yes, update maildir/dbox uidlist lock file every 10
seconds so it won't be treated as a stale lock.



Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- dbox-storage.c	25 Jan 2007 20:00:38 -0000	1.34
+++ dbox-storage.c	22 Feb 2007 12:50:14 -0000	1.35
@@ -1,6 +1,7 @@
-/* Copyright (C) 2005 Timo Sirainen */
+/* Copyright (C) 2005-2007 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "mkdir-parents.h"
 #include "unlink-directory.h"
 #include "index-mail.h"
@@ -17,6 +18,9 @@
 
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
+/* How often to touch the uidlist lock file when using KEEP_LOCKED flag */
+#define DBOX_LOCK_TOUCH_MSECS (10*1000)
+
 const struct dotlock_settings default_uidlist_dotlock_set = {
 	MEMBER(temp_prefix) NULL,
 	MEMBER(lock_suffix) NULL,
@@ -254,6 +258,13 @@
 	return FALSE;
 }
 
+static void dbox_lock_touch_timeout(void *context)
+{
+	struct dbox_mailbox *mbox = context;
+
+	(void)dbox_uidlist_lock_touch(mbox->uidlist);
+}
+
 static struct mailbox *
 dbox_open(struct dbox_storage *storage, const char *name,
 	  enum mailbox_open_flags flags)
@@ -320,6 +331,9 @@
 			mailbox_close(&box);
 			return NULL;
 		}
+		mbox->keep_lock_to = timeout_add(DBOX_LOCK_TOUCH_MSECS,
+						 dbox_lock_touch_timeout,
+						 mbox);
 	}
 	return &mbox->ibox.box;
 }
@@ -533,6 +547,9 @@
 
 	if (mbox->ibox.keep_locked)
 		dbox_uidlist_unlock(mbox->uidlist);
+	if (mbox->keep_lock_to != NULL)
+		timeout_remove(&mbox->keep_lock_to);
+
 	dbox_uidlist_deinit(mbox->uidlist);
 	if (mbox->file != NULL)
 		dbox_file_close(mbox->file);

Index: dbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dbox-storage.h	28 Dec 2006 16:51:11 -0000	1.16
+++ dbox-storage.h	22 Feb 2007 12:50:14 -0000	1.17
@@ -63,6 +63,7 @@
 	struct dbox_uidlist *uidlist;
 
 	const char *path;
+	struct timeout *keep_lock_to;
 
         struct dbox_file *file;
 	uint32_t dbox_file_ext_idx;

Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- dbox-uidlist.c	28 Dec 2006 16:51:12 -0000	1.43
+++ dbox-uidlist.c	22 Feb 2007 12:50:14 -0000	1.44
@@ -448,6 +448,11 @@
 	return 0;
 }
 
+int dbox_uidlist_lock_touch(struct dbox_uidlist *uidlist)
+{
+	return file_dotlock_touch(uidlist->dotlock);
+}
+
 void dbox_uidlist_unlock(struct dbox_uidlist *uidlist)
 {
 	i_assert(uidlist->lock_fd != -1);

Index: dbox-uidlist.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbox-uidlist.h	23 Jul 2006 14:20:59 -0000	1.8
+++ dbox-uidlist.h	22 Feb 2007 12:50:14 -0000	1.9
@@ -21,6 +21,7 @@
 void dbox_uidlist_deinit(struct dbox_uidlist *uidlist);
 
 int dbox_uidlist_lock(struct dbox_uidlist *uidlist);
+int dbox_uidlist_lock_touch(struct dbox_uidlist *uidlist);
 void dbox_uidlist_unlock(struct dbox_uidlist *uidlist);
 
 struct dbox_uidlist_entry *



More information about the dovecot-cvs mailing list