[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.146, 1.147 maildir-storage.h, 1.62, 1.63 maildir-uidlist.c, 1.59, 1.60 maildir-uidlist.h, 1.19, 1.20

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/maildir
In directory talvi:/tmp/cvs-serv11392/maildir

Modified Files:
	maildir-storage.c maildir-storage.h maildir-uidlist.c 
	maildir-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: maildir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- maildir-storage.c	18 Jan 2007 17:20:49 -0000	1.146
+++ maildir-storage.c	22 Feb 2007 12:50:15 -0000	1.147
@@ -20,6 +20,9 @@
 
 #define CREATE_MODE 0777 /* umask() should limit it more */
 
+/* How often to touch the uidlist lock file when using KEEP_LOCKED flag */
+#define MAILDIR_LOCK_TOUCH_MSECS (10*1000)
+
 #define MAILDIR_PLUSPLUS_DRIVER_NAME "maildir++"
 #define MAILDIR_SUBFOLDER_FILENAME "maildirfolder"
 
@@ -384,6 +387,13 @@
 	return maildir_uidlist_is_recent(mbox->uidlist, uid);
 }
 
+static void maildir_lock_touch_timeout(void *context)
+{
+	struct maildir_mailbox *mbox = context;
+
+	(void)maildir_uidlist_lock_touch(mbox->uidlist);
+}
+
 static struct mailbox *
 maildir_open(struct maildir_storage *storage, const char *name,
 	     enum mailbox_open_flags flags)
@@ -448,6 +458,9 @@
 			mailbox_close(&box);
 			return NULL;
 		}
+		mbox->keep_lock_to = timeout_add(MAILDIR_LOCK_TOUCH_MSECS,
+						 maildir_lock_touch_timeout,
+						 mbox);
 	}
 
 	return &mbox->ibox.box;
@@ -869,6 +882,8 @@
 
 	if (mbox->ibox.keep_locked)
 		maildir_uidlist_unlock(mbox->uidlist);
+	if (mbox->keep_lock_to != NULL)
+		timeout_remove(&mbox->keep_lock_to);
 
 	maildir_keywords_deinit(mbox->keywords);
 	maildir_uidlist_deinit(mbox->uidlist);

Index: maildir-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- maildir-storage.h	18 Jan 2007 17:20:49 -0000	1.62
+++ maildir-storage.h	22 Feb 2007 12:50:15 -0000	1.63
@@ -69,6 +69,7 @@
 	struct maildir_storage *storage;
 
 	const char *path, *control_dir;
+	struct timeout *keep_lock_to;
 
 	/* maildir sync: */
 	struct maildir_uidlist *uidlist;

Index: maildir-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-uidlist.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- maildir-uidlist.c	23 Jan 2007 13:48:58 -0000	1.59
+++ maildir-uidlist.c	22 Feb 2007 12:50:15 -0000	1.60
@@ -136,6 +136,13 @@
 	return maildir_uidlist_lock_timeout(uidlist, TRUE);
 }
 
+int maildir_uidlist_lock_touch(struct maildir_uidlist *uidlist)
+{
+	i_assert(UIDLIST_IS_LOCKED(uidlist));
+
+	return file_dotlock_touch(uidlist->dotlock);
+}
+
 bool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist)
 {
 	return UIDLIST_IS_LOCKED(uidlist);

Index: maildir-uidlist.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-uidlist.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- maildir-uidlist.h	22 Dec 2006 14:20:38 -0000	1.19
+++ maildir-uidlist.h	22 Feb 2007 12:50:15 -0000	1.20
@@ -15,6 +15,7 @@
 
 int maildir_uidlist_lock(struct maildir_uidlist *uidlist);
 int maildir_uidlist_try_lock(struct maildir_uidlist *uidlist);
+int maildir_uidlist_lock_touch(struct maildir_uidlist *uidlist);
 void maildir_uidlist_unlock(struct maildir_uidlist *uidlist);
 bool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist);
 



More information about the dovecot-cvs mailing list