Mercurial > dovecot > core-2.2
changeset 15638:d4e7a3184a82
lib-imap-storage: Removed broken optimization for seeking to partial offset.
The optimization worked only when physical_start=0. It would have been
possible to fix it by finding the message_part where its header of body
offset is physical_start and only then start decreasing virtual_skip, but
probably too much complexity to be worth the trouble, especially since
clients rarely would benefit from this optimization.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 11 Jan 2013 06:18:36 +0200 |
parents | b0e0eb30c2b9 |
children | 6654ed22af78 |
files | src/lib-imap-storage/imap-msgpart.c |
diffstat | 1 files changed, 0 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-imap-storage/imap-msgpart.c Fri Jan 11 03:59:50 2013 +0200 +++ b/src/lib-imap-storage/imap-msgpart.c Fri Jan 11 06:18:36 2013 +0200 @@ -371,47 +371,6 @@ return 0; } -static void -skip_using_parts(struct mail *mail, struct istream *input, - uoff_t physical_start, uoff_t *virtual_skip) -{ - enum mail_lookup_abort old_lookup_abort; - struct message_part *parts, *part; - uoff_t vpos; - int ret; - - old_lookup_abort = mail->lookup_abort; - mail->lookup_abort = MAIL_LOOKUP_ABORT_NOT_IN_CACHE; - ret = mail_get_parts(mail, &parts); - mail->lookup_abort = old_lookup_abort; - if (ret < 0) - return; - - for (part = parts, vpos = 0; part != NULL; ) { - if (vpos + part->header_size.virtual_size > *virtual_skip) - break; - /* skip header */ - vpos += part->header_size.virtual_size; - *virtual_skip -= part->header_size.virtual_size; - i_stream_seek(input, physical_start + part->physical_pos + - part->header_size.physical_size); - - if (vpos + part->body_size.virtual_size <= *virtual_skip) { - /* skip body */ - vpos += part->body_size.virtual_size; - *virtual_skip -= part->body_size.virtual_size; - i_stream_seek(input, physical_start + - part->physical_pos + - part->header_size.physical_size + - part->body_size.physical_size); - part = part->next; - } else { - /* maybe we have a child and can skip using it? */ - part = part->children; - } - } -} - static struct istream * imap_msgpart_crlf_seek(struct mail *mail, struct istream *input, const struct imap_msgpart *msgpart) @@ -432,10 +391,6 @@ /* use cache */ i_stream_seek(input, physical_start + cache->physical_pos); virtual_skip -= cache->virtual_pos; - } else { - /* can't use cache, but maybe we can skip faster using the - message parts. */ - skip_using_parts(mail, input, physical_start, &virtual_skip); } if (message_skip_virtual(input, virtual_skip, &cr_skipped) < 0) { errinput = i_stream_create_error(errno);