[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.15.2.10, 1.15.2.11 dbox-storage.h, 1.10.2.2, 1.10.2.3 dbox-uidlist.c, 1.28.2.12, 1.28.2.13 dbox-uidlist.h, 1.5.2.2, 1.5.2.3

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


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

Modified Files:
      Tag: branch_1_0
	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.15.2.10
retrieving revision 1.15.2.11
diff -u -d -r1.15.2.10 -r1.15.2.11
--- dbox-storage.c	14 Jan 2007 01:47:16 -0000	1.15.2.10
+++ dbox-storage.c	22 Feb 2007 12:50:08 -0000	1.15.2.11
@@ -1,6 +1,7 @@
-/* Copyright (C) 2005 Timo Sirainen */
+/* Copyright (C) 2005-2007 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "home-expand.h"
 #include "mkdir-parents.h"
 #include "unlink-directory.h"
@@ -19,6 +20,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)
+
 /* Don't allow creating too long mailbox names. They could start causing
    problems when they reach the limit. */
 #define DBOX_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
@@ -382,6 +386,13 @@
 	return dbox_get_path(istorage, name);
 }
 
+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)
@@ -449,6 +460,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;
 }
@@ -714,6 +728,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.10.2.2
retrieving revision 1.10.2.3
diff -u -d -r1.10.2.2 -r1.10.2.3
--- dbox-storage.h	28 Dec 2006 16:51:06 -0000	1.10.2.2
+++ dbox-storage.h	22 Feb 2007 12:50:08 -0000	1.10.2.3
@@ -62,6 +62,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.28.2.12
retrieving revision 1.28.2.13
diff -u -d -r1.28.2.12 -r1.28.2.13
--- dbox-uidlist.c	28 Dec 2006 16:51:06 -0000	1.28.2.12
+++ dbox-uidlist.c	22 Feb 2007 12:50:08 -0000	1.28.2.13
@@ -451,6 +451,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.5.2.2
retrieving revision 1.5.2.3
diff -u -d -r1.5.2.2 -r1.5.2.3
--- dbox-uidlist.h	23 Jul 2006 14:20:58 -0000	1.5.2.2
+++ dbox-uidlist.h	22 Feb 2007 12:50:08 -0000	1.5.2.3
@@ -19,6 +19,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