]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3c: Prefetched streams didn't call istream_opened() or set virtual_size
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 22 Feb 2017 18:03:43 +0000 (20:03 +0200)
committerGitLab <gitlab@git.dovecot.net>
Wed, 22 Feb 2017 18:25:10 +0000 (20:25 +0200)
src/lib-storage/index/pop3c/pop3c-mail.c

index e2b61860d513c965fc2a7a2688bf20dfa5c55f17..b34cf78130dc915bdbd9ede51e04e9ab95bdf2e4 100644 (file)
@@ -185,6 +185,7 @@ pop3c_mail_get_stream(struct mail *_mail, bool get_body,
        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 @@ pop3c_mail_get_stream(struct mail *_mail, bool get_body,
        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 @@ pop3c_mail_get_stream(struct mail *_mail, bool get_body,
                        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 @@ pop3c_mail_get_stream(struct mail *_mail, bool get_body,
                                return -1;
                        }
                }
-               i_stream_set_name(mail->data.stream, t_strcut(cmd, '\r'));
                if (get_body)
                        pop3c_mail_cache_size(mail);
        }