changeset 21678:3243312b3d88

pop3c: Prefetched streams didn't call istream_opened() or set virtual_size
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 22 Feb 2017 20:03:43 +0200
parents 9479458bcc69
children d439e77f6b1f
files src/lib-storage/index/pop3c/pop3c-mail.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/pop3c/pop3c-mail.c	Wed Feb 22 17:45:34 2017 +0200
+++ b/src/lib-storage/index/pop3c/pop3c-mail.c	Wed Feb 22 20:03:43 2017 +0200
@@ -185,6 +185,7 @@
 	enum pop3c_capability capa;
 	const char *name, *cmd, *error;
 	struct istream *input;
+	bool new_stream = FALSE;
 
 	if ((mail->data.access_part & (READ_BODY | PARSE_BODY)) != 0)
 		get_body = TRUE;
@@ -197,6 +198,7 @@
 	if (pmail->prefetch_stream != NULL && mail->data.stream == NULL) {
 		mail->data.stream = pmail->prefetch_stream;
 		pmail->prefetch_stream = NULL;
+		new_stream = TRUE;
 	}
 
 	if (get_body && mail->data.stream != NULL) {
@@ -228,6 +230,10 @@
 			return -1;
 		}
 		mail->data.stream = input;
+		i_stream_set_name(mail->data.stream, t_strcut(cmd, '\r'));
+		new_stream = TRUE;
+	}
+	if (new_stream) {
 		if (mail->mail.v.istream_opened != NULL) {
 			if (mail->mail.v.istream_opened(_mail,
 							&mail->data.stream) < 0) {
@@ -235,7 +241,6 @@
 				return -1;
 			}
 		}
-		i_stream_set_name(mail->data.stream, t_strcut(cmd, '\r'));
 		if (get_body)
 			pop3c_mail_cache_size(mail);
 	}