[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.33, 1.34 index-mail.c, 1.48, 1.49 index-storage.c, 1.61, 1.62

cras at dovecot.org cras at dovecot.org
Sun Aug 15 06:40:34 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv20173/lib-storage/index

Modified Files:
	index-mail-headers.c index-mail.c index-storage.c 
Log Message:
We never do blocking reads/writes to network anymore. Changed imap and pop3
processes to use a single I/O loop.

Not much tested yet, and currently LIST/LSUB may eat too much memory and
APPEND eats all CPU.



Index: index-mail-headers.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- index-mail-headers.c	31 Jul 2004 00:33:53 -0000	1.33
+++ index-mail-headers.c	15 Aug 2004 03:40:32 -0000	1.34
@@ -320,10 +320,8 @@
 {
 	struct index_mail_data *data = &mail->data;
 
-	if (data->stream == NULL) {
-		if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
-			return FALSE;
-	}
+	if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
+		return FALSE;
 
 	index_mail_parse_header_init(mail, headers);
 
@@ -508,7 +506,7 @@
 }
 
 static void header_cache_callback(struct message_header_line *hdr,
-				  int matched __attr_unused__, void *context)
+				  int *matched __attr_unused__, void *context)
 {
 	struct index_mail *mail = context;
 
@@ -534,10 +532,8 @@
 	/* not in cache / error */
 	p_free(mail->pool, dest);
 
-	if (mail->data.stream == NULL) {
-		if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
-			return FALSE;
-	}
+	if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
+		return FALSE;
 
 	if (mail->data.filter_stream != NULL)
 		i_stream_unref(mail->data.filter_stream);
@@ -551,13 +547,6 @@
 	return mail->data.filter_stream;
 }
 
-static int strcasecmp_p(const void *p1, const void *p2)
-{
-	const char *const *s1 = p1, *const *s2 = p2;
-
-	return strcasecmp(*s1, *s2);
-}
-
 struct mailbox_header_lookup_ctx *
 index_header_lookup_init(struct mailbox *box, const char *const headers[])
 {

Index: index-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- index-mail.c	23 Jul 2004 18:36:10 -0000	1.48
+++ index-mail.c	15 Aug 2004 03:40:32 -0000	1.49
@@ -236,12 +236,12 @@
 	return data->sent_date.time;
 }
 
-static int get_msgpart_sizes(struct index_mail *mail)
+static int get_cached_msgpart_sizes(struct index_mail *mail)
 {
 	struct index_mail_data *data = &mail->data;
 
 	if (data->parts == NULL)
-		(void)index_mail_get_parts(&mail->mail);
+		data->parts = get_cached_parts(mail);
 
 	if (data->parts != NULL) {
 		data->hdr_size = data->parts->header_size;
@@ -268,12 +268,15 @@
 	if (data->size != (uoff_t)-1)
 		return data->size;
 
-	if (get_msgpart_sizes(mail))
+	if (get_cached_msgpart_sizes(mail))
 		return data->size;
 
 	if (_mail->get_stream(_mail, &hdr_size, &body_size) == NULL)
 		return (uoff_t)-1;
 
+	mail_cache_add(mail->trans->cache_trans, mail->data.seq,
+		       cache_fields[MAIL_CACHE_VIRTUAL_FULL_SIZE].idx,
+		       &data->size, sizeof(data->size));
 	return data->size;
 }
 
@@ -373,7 +376,7 @@
 	struct index_mail_data *data = &mail->data;
 
 	if (hdr_size != NULL || body_size != NULL)
-		(void)get_msgpart_sizes(mail);
+		(void)get_cached_msgpart_sizes(mail);
 
 	if (hdr_size != NULL) {
 		if (!data->hdr_size_set) {

Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- index-storage.c	23 Jul 2004 18:38:35 -0000	1.61
+++ index-storage.c	15 Aug 2004 03:40:32 -0000	1.62
@@ -223,14 +223,6 @@
 	const char *str;
 	time_t now;
 
-	if ((secs_left % 15) != 0) {
-		/* update alarm() so that we get back here around the same
-		   time we want the next notify. also try to use somewhat
-		   rounded times. this affects only fcntl() locking, dotlock
-		   and flock() calls should be calling us constantly */
-		alarm(secs_left%15);
-	}
-
 	/* if notify type changes, print the message immediately */
 	now = time(NULL);
 	if (ibox->last_notify_type == MAILBOX_LOCK_NOTIFY_NONE ||



More information about the dovecot-cvs mailing list