From 558229b49eb9fd5ad15a57a437c97c63aaf43bd8 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 21 Oct 2017 19:00:20 +0100 Subject: [Fix] Actively load skip hashes map in fuzzy storage MFH: rspamd-1.6 --- src/fuzzy_storage.c | 12 ++++++++++-- src/libutil/map.c | 5 ++++- src/libutil/map_private.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index e08598969..54d3db224 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -18,6 +18,7 @@ */ #include +#include #include "config.h" #include "util.h" #include "rspamd.h" @@ -2799,12 +2800,19 @@ start_fuzzy (struct rspamd_worker *worker) &ctx->master_ips, NULL); } if (ctx->skip_map != NULL) { - if (!rspamd_map_add_from_ucl (cfg, ctx->skip_map, + struct rspamd_map *m; + + if ((m = rspamd_map_add_from_ucl (cfg, ctx->skip_map, "Skip hashes", rspamd_kv_list_read, rspamd_kv_list_fin, - (void **)&ctx->skip_hashes)) { + (void **)&ctx->skip_hashes)) == NULL) { msg_warn_config ("cannot load hashes list from %s", ucl_object_tostring (ctx->skip_map)); } + else { + if (worker->index == 0) { + m->active_http = TRUE; + } + } } /* Maps events */ diff --git a/src/libutil/map.c b/src/libutil/map.c index 892122ef0..892bf0e0c 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -1565,7 +1565,10 @@ rspamd_map_watch (struct rspamd_config *cfg, struct event_base *ev_base, map = cur->data; map->ev_base = ev_base; map->r = resolver; - map->active_http = active_http; + + if (active_http) { + map->active_http = active_http; + } rspamd_map_schedule_periodic (map, FALSE, TRUE, FALSE); diff --git a/src/libutil/map_private.h b/src/libutil/map_private.h index 79c3164e6..f1a9d22e4 100644 --- a/src/libutil/map_private.h +++ b/src/libutil/map_private.h @@ -20,6 +20,7 @@ #include "mem_pool.h" #include "keypair.h" #include "unix-std.h" +#include "map.h" #include "ref.h" typedef void (*rspamd_map_dtor) (gpointer p); -- cgit v1.2.3