dovecot-2.0: snarf: Keep the mailbox locked during snarfing to a...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 9 19:33:19 EET 2012
details: http://hg.dovecot.org/dovecot-2.0/rev/76220f2b5966
changeset: 13046:76220f2b5966
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 09 19:33:15 2012 +0200
description:
snarf: Keep the mailbox locked during snarfing to avoid duplicates.
diffstat:
src/plugins/snarf/snarf-plugin.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r 750db4b4c7d3 -r 76220f2b5966 src/plugins/snarf/snarf-plugin.c
--- a/src/plugins/snarf/snarf-plugin.c Thu Feb 09 05:17:48 2012 +0200
+++ b/src/plugins/snarf/snarf-plugin.c Thu Feb 09 19:33:15 2012 +0200
@@ -37,7 +37,8 @@
enum mail_error error;
int ret;
- /* make sure the destination mailbox has been opened */
+ /* make sure the destination mailbox has been opened.
+ note that this locks the mailbox. */
if (mailbox_open(destbox) < 0)
return -1;
@@ -104,6 +105,8 @@
struct snarf_mailbox *sbox = SNARF_CONTEXT(box);
(void)snarf(sbox->snarf_box, box);
+ /* close the mailbox so that we don't have to keep it locked */
+ (void)mailbox_close(sbox->snarf_box);
return sbox->module_ctx.super.sync_init(box, flags);
}
@@ -158,7 +161,8 @@
box->vlast = &sbox->module_ctx.super;
sbox->snarf_box = mailbox_alloc(snarf_list, snarf_name,
- MAILBOX_FLAG_KEEP_RECENT);
+ MAILBOX_FLAG_KEEP_RECENT |
+ MAILBOX_FLAG_KEEP_LOCKED);
v->sync_init = snarf_sync_init;
v->free = snarf_mailbox_free;
More information about the dovecot-cvs
mailing list