Mercurial > dovecot > core-2.2
changeset 21189:17b19f94a319
quota-clone: Code cleanup - moved recursion check to quota_clone_flush()
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 21 Nov 2016 14:02:11 +0200 |
parents | f9b84d8a718b |
children | 263658888a0d |
files | src/plugins/quota-clone/quota-clone-plugin.c |
diffstat | 1 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota-clone/quota-clone-plugin.c Mon Nov 21 23:43:08 2016 +0200 +++ b/src/plugins/quota-clone/quota-clone-plugin.c Mon Nov 21 14:02:11 2016 +0200 @@ -32,7 +32,7 @@ bool quota_changed; }; -static void quota_clone_flush(struct mailbox *box) +static void quota_clone_flush_real(struct mailbox *box) { struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); struct quota_clone_user *quser = @@ -76,6 +76,21 @@ qbox->quota_changed = FALSE; } +static void quota_clone_flush(struct mailbox *box) +{ + struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); + struct quota_clone_user *quser = + QUOTA_CLONE_USER_CONTEXT(box->storage->user); + + if (quser->quota_flushing) { + /* recursing back from quota recalculation */ + } else if (qbox->quota_changed) { + quser->quota_flushing = TRUE; + quota_clone_flush_real(box); + quser->quota_flushing = FALSE; + } +} + static int quota_clone_save_finish(struct mail_save_context *ctx) { struct quota_clone_mailbox *qbox = @@ -111,18 +126,10 @@ static void quota_clone_mailbox_close(struct mailbox *box) { struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); - struct quota_clone_user *quser = - QUOTA_CLONE_USER_CONTEXT(box->storage->user); qbox->module_ctx.super.close(box); - if (quser->quota_flushing) { - /* recursing back from quota recalculation */ - } else if (qbox->quota_changed) { - quser->quota_flushing = TRUE; - quota_clone_flush(box); - quser->quota_flushing = FALSE; - } + quota_clone_flush(box); } static void quota_clone_mailbox_allocated(struct mailbox *box)