On Fri, 2009-08-07 at 15:31 -0400, Timo Sirainen wrote: > Does the attached patch help? Although it makes performance slightly > worse.. Probably not noticeably. If it works, I'll just commit it to the > next release.
Sorry, I messed up the patch. Should have used "hg diff", not "hg export tip" :) Attached a working one this time.
diff -r 96b764649cbb src/plugins/mbox-snarf/mbox-snarf-plugin.c
--- a/src/plugins/mbox-snarf/mbox-snarf-plugin.c Fri Aug 07 15:12:04 2009 -0400
+++ b/src/plugins/mbox-snarf/mbox-snarf-plugin.c Fri Aug 07 15:32:18 2009 -0400
@@ -23,8 +23,6 @@
struct mbox_snarf_mailbox {
union mailbox_module_context module_ctx;
-
- struct mailbox *spool_mbox;
};
const char *mbox_snarf_plugin_version = PACKAGE_VERSION;
@@ -108,31 +106,26 @@
MBOX_SNARF_CONTEXT(box->storage);
struct mail_storage *storage;
struct mbox_snarf_mailbox *mbox = MBOX_SNARF_CONTEXT(box);
+ struct mailbox *spool_mbox;
+ static struct mailbox_sync_context *ctx;
- if (mbox->spool_mbox == NULL) {
- /* try to open the spool mbox */
- mstorage->open_spool_inbox = TRUE;
- storage = box->storage;
- mbox->spool_mbox =
- mailbox_open(&storage, "INBOX", NULL,
- MAILBOX_OPEN_KEEP_RECENT |
- MAILBOX_OPEN_NO_INDEX_FILES);
- mstorage->open_spool_inbox = FALSE;
- }
+ /* try to open the spool mbox */
+ mstorage->open_spool_inbox = TRUE;
+ storage = box->storage;
+ spool_mbox = mailbox_open(&storage, "INBOX", NULL,
+ MAILBOX_OPEN_KEEP_LOCKED |
+ MAILBOX_OPEN_KEEP_RECENT |
+ MAILBOX_OPEN_NO_INDEX_FILES);
+ mstorage->open_spool_inbox = FALSE;
- if (mbox->spool_mbox != NULL)
- mbox_snarf(mbox->spool_mbox, box);
+ if (spool_mbox != NULL)
+ mbox_snarf(spool_mbox, box);
- return mbox->module_ctx.super.sync_init(box, flags);
-}
+ ctx = mbox->module_ctx.super.sync_init(box, flags);
-static int mbox_snarf_close(struct mailbox *box)
-{
- struct mbox_snarf_mailbox *mbox = MBOX_SNARF_CONTEXT(box);
-
- if (mbox->spool_mbox != NULL)
- mailbox_close(&mbox->spool_mbox);
- return mbox->module_ctx.super.close(box);
+ if (spool_mbox != NULL)
+ mailbox_close(&spool_mbox);
+ return ctx;
}
static struct mailbox *
@@ -178,7 +171,6 @@
mbox->module_ctx.super = box->v;
box->v.sync_init = mbox_snarf_sync_init;
- box->v.close = mbox_snarf_close;
MODULE_CONTEXT_SET(box, mbox_snarf_storage_module, mbox);
return box;
}
signature.asc
Description: This is a digitally signed message part
