Skip to content

Commit

Permalink
fts: Use mailbox_list_created hook
Browse files Browse the repository at this point in the history
Otherwise the deinit hook might get lost and fts would not be deinitialized.

Reverts 11f12ca which seems to have been unnecessary

Fixes indexer-worker signal 11 crash
  • Loading branch information
cmouse authored and GitLab committed Feb 3, 2017
1 parent f32382d commit 7919541
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/plugins/fts/fts-plugin.c
Expand Up @@ -13,7 +13,7 @@
const char *fts_plugin_version = DOVECOT_ABI_VERSION;

static struct mail_storage_hooks fts_mail_storage_hooks = {
.mail_namespaces_added = fts_mail_namespaces_added,
.mailbox_list_created = fts_mailbox_list_created,
.mailbox_allocated = fts_mailbox_allocated,
.mail_allocated = fts_mail_allocated
};
Expand Down
29 changes: 9 additions & 20 deletions src/plugins/fts/fts-storage.c
Expand Up @@ -830,13 +830,18 @@ static void fts_mailbox_list_deinit(struct mailbox_list *list)
flist->module_ctx.super.deinit(list);
}



static void
fts_mailbox_list_init(struct mailbox_list *list, const char *name)
void
fts_mailbox_list_created(struct mailbox_list *list)
{
struct fts_backend *backend;
const char *path, *error;
const char *name = mail_user_plugin_getenv(list->ns->user, "fts");

if (name == NULL || name[0] == '\0') {
if (list->mail_set->mail_debug)
i_debug("fts: No fts setting - plugin disabled");
return;
}

if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, &path)) {
if (list->mail_set->mail_debug) {
Expand Down Expand Up @@ -865,22 +870,6 @@ fts_mailbox_list_init(struct mailbox_list *list, const char *name)
}
}

void fts_mail_namespaces_added(struct mail_namespace *namespaces)
{
struct mail_namespace *ns;
const char *name;

name = mail_user_plugin_getenv(namespaces->user, "fts");
if (name == NULL || name[0] == '\0') {
if (namespaces->user->mail_debug)
i_debug("fts: No fts setting - plugin disabled");
return;
}

for (ns = namespaces; ns != NULL; ns = ns->next)
fts_mailbox_list_init(ns->list, name);
}

struct fts_backend *fts_mailbox_backend(struct mailbox *box)
{
struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(box->list);
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/fts/fts-storage.h
Expand Up @@ -53,6 +53,5 @@ struct fts_backend *fts_list_backend(struct mailbox_list *list);

void fts_mail_allocated(struct mail *mail);
void fts_mailbox_allocated(struct mailbox *box);
void fts_mail_namespaces_added(struct mail_namespace *namespaces);

void fts_mailbox_list_created(struct mailbox_list *list);
#endif

0 comments on commit 7919541

Please sign in to comment.