Mercurial > dovecot > core-2.2
changeset 18322:d21f71ab9f28
imapc: Make sure we don't flush prefetch FETCH command unneededly.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 11 Mar 2015 14:39:26 +0200 |
parents | 878e9d914339 |
children | f8f57dde247d |
files | src/lib-storage/index/imapc/imapc-mail-fetch.c src/lib-storage/index/imapc/imapc-mail.h |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mail-fetch.c Wed Mar 11 13:28:24 2015 +0200 +++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c Wed Mar 11 14:39:26 2015 +0200 @@ -171,7 +171,7 @@ if (headers_have_subset(mail->fetching_headers, headers)) headers = NULL; if (fields == 0 && headers == NULL) - return 0; + return mail->fetch_sent ? 0 : 1; if (!_mail->saving) { /* if we already know that the mail is expunged, @@ -229,6 +229,7 @@ pool_ref(mail->imail.mail.pool); mail->fetching_fields |= fields; mail->fetch_count++; + mail->fetch_sent = FALSE; imapc_mail_delayed_send_or_merge(mail, str); return 1; @@ -365,7 +366,8 @@ /* we'll continue waiting until we've got all the fields we wanted, or until all FETCH replies have been received (i.e. some FETCHes failed) */ - imapc_mail_fetch_flush(mbox); + if (ret > 0) + imapc_mail_fetch_flush(mbox); while (imail->fetch_count > 0 && (!imapc_mail_have_fields(imail, fields) || !imail->header_list_fetched)) @@ -376,12 +378,16 @@ void imapc_mail_fetch_flush(struct imapc_mailbox *mbox) { struct imapc_command *cmd; + struct imapc_mail *const *mailp; if (mbox->pending_fetch_request == NULL) { i_assert(mbox->to_pending_fetch_send == NULL); return; } + array_foreach(&mbox->pending_fetch_request->mails, mailp) + (*mailp)->fetch_sent = TRUE; + cmd = imapc_client_mailbox_cmd(mbox->client_box, imapc_mail_fetch_callback, mbox->pending_fetch_request);
--- a/src/lib-storage/index/imapc/imapc-mail.h Wed Mar 11 13:28:24 2015 +0200 +++ b/src/lib-storage/index/imapc/imapc-mail.h Wed Mar 11 14:39:26 2015 +0200 @@ -13,6 +13,7 @@ enum mail_fetch_field fetching_fields; const char *const *fetching_headers; unsigned int fetch_count; + bool fetch_sent; int fd; buffer_t *body;