[Pkg-wmaker-commits] [wmbiff] 59/84: * maildirClient: Added support for quick checking of writable network-mounted maildirs where directory caching normally causes unwanted delays.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_10
in repository wmbiff.

commit bc46cb468915a6a437f3a289eb7c9cb757bb575c
Author: dwonis <dwonis>
Date:   Sat Sep 14 18:51:46 2002 +0000

    * maildirClient: Added support for quick checking of writable network-mounted
      maildirs where directory caching normally causes unwanted delays.
---
 wmbiff/Client.h        |  5 +++--
 wmbiff/maildirClient.c | 38 +++++++++++++++++++++++++++++++++++---
 wmbiff/wmbiffrc.5.in   | 12 ++++++++++--
 3 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index 9d62b89..cf95230 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,11 +1,11 @@
-/* $Id: Client.h,v 1.26 2002/06/21 04:29:58 bluehal Exp $ */
+/* $Id: Client.h,v 1.27 2002/09/14 18:51:46 dwonis Exp $ */
 /* Author : Scott Holden ( scotth at thezone.net )
    Modified : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
  *
  * Email Checker Pop3/Imap4/Licq/Gicu/mbox/maildir/finger
  *
- * Last Updated : $Date: 2002/06/21 04:29:58 $
+ * Last Updated : $Date: 2002/09/14 18:51:46 $
  *
  */
 
@@ -51,6 +51,7 @@ typedef struct _mbox_t {
 			off_t size_new;
 			time_t mtime_cur;
 			off_t size_cur;
+			unsigned int dircache_flush:1; /* hack to flush directory caches */
 		} maildir;
 		struct {
 			char password[32];
diff --git a/wmbiff/maildirClient.c b/wmbiff/maildirClient.c
index 6071520..7e197fa 100644
--- a/wmbiff/maildirClient.c
+++ b/wmbiff/maildirClient.c
@@ -1,11 +1,11 @@
-/* $Id: maildirClient.c,v 1.8 2002/06/21 04:31:31 bluehal Exp $ */
+/* $Id: maildirClient.c,v 1.9 2002/09/14 18:51:46 dwonis Exp $ */
 /* Author : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
    Modified : Dwayne C. Litzenberger ( dlitz at dlitz.net )
  * 
  * Maildir checker.
  *
- * Last Updated : $Date: 2002/06/21 04:31:31 $
+ * Last Updated : $Date: 2002/09/14 18:51:46 $
  *
  */
 
@@ -54,6 +54,8 @@ int maildirCheckHistory(Pop3 pc)
 	struct stat st_cur;
 	struct utimbuf ut;
 	char path_new[256], path_cur[256];
+	char path_newtmp[512];
+	char *fn;
 
 	int count_new = 0, count_cur = 0;
 
@@ -63,6 +65,18 @@ int maildirCheckHistory(Pop3 pc)
 	strcat(path_new, "/new/");
 	strcpy(path_cur, pc->path);
 	strcat(path_cur, "/cur/");
+	strcpy(path_newtmp, path_new);
+	strcat(path_newtmp, ".wmbiff.dircache_flush.XXXXXX");
+
+	if (pc->u.maildir.dircache_flush) {
+		/* hack to clear directory cache for network-mounted maildirs*/
+		if (fn = mktemp(path_newtmp)) {
+			unlink(fn);
+		} else {
+			DM(pc, DEBUG_ERROR, "Can't create dircache flush file '%s': %s\n",
+		   		path_newtmp, strerror(errno));
+		}
+	}
 
 	/* maildir */
 	if (stat(path_new, &st_new)) {
@@ -121,6 +135,8 @@ int maildirCheckHistory(Pop3 pc)
 
 int maildirCreate(Pop3 pc, const char *str)
 {
+	int i;
+	char c;
 	/* Maildir format: maildir:fullpathname */
 
 	pc->TotalMsgs = 0;
@@ -128,7 +144,23 @@ int maildirCreate(Pop3 pc, const char *str)
 	pc->OldMsgs = -1;
 	pc->OldUnreadMsgs = -1;
 	pc->checkMail = maildirCheckHistory;
-	strcpy(pc->path, str + 8);	/* cut off ``maildir:'' */
+	pc->u.maildir.dircache_flush = 0;
+
+	/* special flags */
+	if (*(str + 8) == ':') { /* path is of the format maildir::flags:path */
+		c = ' ';
+		for (i = 1; c != ':' && c != '\0'; i++) {
+			c = *(str + 8 + i);
+			switch (c) {
+			case 'F':
+				pc->u.maildir.dircache_flush = 1;
+				DM(pc, DEBUG_INFO, "maildir: dircache_flush enabled\n");
+			}
+		}
+	} else {
+		i = 0;
+	}
+	strcpy(pc->path, str + 8 + i);	/* cut off ``maildir:'' */
 
 	DM(pc, DEBUG_INFO, "maildir: str = '%s'\n", str);
 	DM(pc, DEBUG_INFO, "maildir: path= '%s'\n", pc->path);
diff --git a/wmbiff/wmbiffrc.5.in b/wmbiff/wmbiffrc.5.in
index 9d9b103..1b47f8b 100644
--- a/wmbiff/wmbiffrc.5.in
+++ b/wmbiff/wmbiffrc.5.in
@@ -1,5 +1,5 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" $Id: wmbiffrc.5.in,v 1.4 2002/05/03 05:42:44 bluehal Exp $
+.\" $Id: wmbiffrc.5.in,v 1.5 2002/09/14 18:51:46 dwonis Exp $
 .\"
 .\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2002 by 
 .\" Jordi Mallach <jordi at debian.org>
@@ -69,7 +69,15 @@ mbox:/path/to/mail/debian-devel
 .I maildir
 This works just like \fImbox\fP above.  
 .RS
-maildir:/path/to/mail/bugtraq/
+maildir:[:\fIflags\fP:]/path/to/mail/bugtraq/
+.TP
+\fIflags\fP can one or more of:
+.TP
+.I F
+Flush directory caches by creating (then deleting) a temporary file
+in each maildir prior to checking.  This hack speeds up checking 
+network-mounted maildirs in cases where directory caching can cause 
+unwanted delays (eg. SFS-mounted maildirs).
 .RE
 .TP
 .I pop3

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list