Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6006:9da1ec15340d HEAD
We didn't cache correctly headers that existed in cache file for other
messages, but we weren't currently interested of.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 15 Jul 2007 02:45:25 +0300 |
parents | 7c1e6ea4bfab |
children | cc1f4688a988 |
files | src/lib-storage/index/index-mail-headers.c src/lib-storage/index/index-mail.h |
diffstat | 2 files changed, 14 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c Sun Jul 15 02:43:34 2007 +0300 +++ b/src/lib-storage/index/index-mail-headers.c Sun Jul 15 02:45:25 2007 +0300 @@ -140,25 +140,6 @@ index_mail_cache_add_idx(mail, match_idx, NULL, 0); } } - - /* set all non-found headers registered in cache */ - for (i = 0; i < mail->data.all_cache_fields_count; i++) { - unsigned int cache_field = mail->data.all_cache_fields[i].idx; - - /* first check that it isn't already added in this session */ - if (cache_field < match_count && - (match[cache_field] & ~1) == mail->header_match_value) - continue; - - if (strncasecmp(mail->data.all_cache_fields[i].name, - "hdr.", 4) != 0) - continue; - - /* check that it hadn't been added in some older session */ - if (mail_cache_field_exists(mail->trans->cache_view, - mail->data.seq, cache_field) == 0) - index_mail_cache_add_idx(mail, cache_field, NULL, 0); - } t_pop(); } @@ -188,7 +169,8 @@ { struct index_header_lookup_ctx *headers = (struct index_header_lookup_ctx *)_headers; - size_t i; + const struct mail_cache_field *all_cache_fields; + unsigned int i, count; mail->header_seq = mail->data.seq; if (mail->header_data == NULL) { @@ -232,14 +214,19 @@ &mail->header_match_value); } - /* get a list of all currently cached fields. we'll later set those - headers that weren't found to empty. if this list is get later, - it's possible that it has already changed (cache has no permanent - write locks, remember!) and we set some headers to empty even - though they really exist. */ - mail->data.all_cache_fields = + /* register also all the other headers that exist in cache file */ + t_push(); + all_cache_fields = mail_cache_register_get_list(mail->ibox->cache, - mail->data_pool, &mail->data.all_cache_fields_count); + pool_datastack_create(), &count); + for (i = 0; i < count; i++) { + if (strncasecmp(all_cache_fields[i].name, "hdr.", 4) == 0) { + array_idx_set(&mail->header_match, + all_cache_fields[i].idx, + &mail->header_match_value); + } + } + t_pop(); } static void index_mail_parse_finish_imap_envelope(struct index_mail *mail)
--- a/src/lib-storage/index/index-mail.h Sun Jul 15 02:43:34 2007 +0300 +++ b/src/lib-storage/index/index-mail.h Sun Jul 15 02:45:25 2007 +0300 @@ -91,9 +91,6 @@ int parsing_count; ARRAY_TYPE(keywords) keywords; - const struct mail_cache_field *all_cache_fields; - unsigned int all_cache_fields_count; - unsigned int save_sent_date:1; unsigned int save_envelope:1; unsigned int save_bodystructure_header:1;