Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7550:d920ec986c34 HEAD
Maildir: Moved uidlist refreshing to maildir_uidlist_lookup() where it
benefits all callers.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 25 May 2008 05:01:47 +0300 |
parents | e54ca78ce35f |
children | 5b27f5cbf016 |
files | src/lib-storage/index/maildir/maildir-mail.c src/lib-storage/index/maildir/maildir-uidlist.c |
diffstat | 2 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-mail.c Sun May 25 04:49:08 2008 +0300 +++ b/src/lib-storage/index/maildir/maildir-mail.c Sun May 25 05:01:47 2008 +0300 @@ -152,14 +152,6 @@ if (*fname_r != NULL) return TRUE; - /* refresh uidlist and check again in case it was added after the last - mailbox sync */ - if (maildir_uidlist_refresh(mbox->uidlist) < 0) - return FALSE; - *fname_r = maildir_uidlist_lookup(mbox->uidlist, mail->uid, &flags); - if (*fname_r != NULL) - return TRUE; - /* file exists in index file, but not in dovecot-uidlist anymore. */ mail_set_expunged(mail);
--- a/src/lib-storage/index/maildir/maildir-uidlist.c Sun May 25 04:49:08 2008 +0300 +++ b/src/lib-storage/index/maildir/maildir-uidlist.c Sun May 25 05:01:47 2008 +0300 @@ -821,12 +821,16 @@ fname = maildir_uidlist_lookup_nosync(uidlist, uid, flags_r); if (fname == NULL) { - if (uidlist->fd != -1 || uidlist->mbox == NULL) - return NULL; - - /* the uidlist doesn't exist. */ - if (maildir_storage_sync_force(uidlist->mbox, uid) < 0) - return NULL; + if (uidlist->fd != -1 || uidlist->mbox == NULL) { + /* refresh uidlist and check again in case it was added + after the last mailbox sync */ + if (maildir_uidlist_refresh(uidlist) < 0) + return NULL; + } else { + /* the uidlist doesn't exist. */ + if (maildir_storage_sync_force(uidlist->mbox, uid) < 0) + return NULL; + } /* try again */ fname = maildir_uidlist_lookup_nosync(uidlist, uid, flags_r);