[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.115.2.22, 1.115.2.23 maildir-storage.h, 1.49.2.6, 1.49.2.7 maildir-uidlist.c, 1.51.2.5, 1.51.2.6 maildir-uidlist.h, 1.17.2.2, 1.17.2.3

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


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

Modified Files:
      Tag: branch_1_0
	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.115.2.22
retrieving revision 1.115.2.23
diff -u -d -r1.115.2.22 -r1.115.2.23
--- maildir-storage.c	24 Jan 2007 20:10:00 -0000	1.115.2.22
+++ maildir-storage.c	22 Feb 2007 12:50:09 -0000	1.115.2.23
@@ -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)
+
 /* Don't allow creating too long mailbox names. They could start causing
    problems when they reach the limit. */
 #define MAILDIR_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
@@ -473,6 +476,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)
@@ -538,6 +548,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;
@@ -1053,6 +1066,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.49.2.6
retrieving revision 1.49.2.7
diff -u -d -r1.49.2.6 -r1.49.2.7
--- maildir-storage.h	18 Jan 2007 17:20:45 -0000	1.49.2.6
+++ maildir-storage.h	22 Feb 2007 12:50:09 -0000	1.49.2.7
@@ -67,6 +67,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.51.2.5
retrieving revision 1.51.2.6
diff -u -d -r1.51.2.5 -r1.51.2.6
--- maildir-uidlist.c	18 Jan 2007 17:20:45 -0000	1.51.2.5
+++ maildir-uidlist.c	22 Feb 2007 12:50:09 -0000	1.51.2.6
@@ -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.17.2.2
retrieving revision 1.17.2.3
diff -u -d -r1.17.2.2 -r1.17.2.3
--- maildir-uidlist.h	22 Dec 2006 14:20:31 -0000	1.17.2.2
+++ maildir-uidlist.h	22 Feb 2007 12:50:09 -0000	1.17.2.3
@@ -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