]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Actively load skip hashes map in fuzzy storage
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 21 Oct 2017 18:00:20 +0000 (19:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 21 Oct 2017 18:00:44 +0000 (19:00 +0100)
MFH: rspamd-1.6

src/fuzzy_storage.c
src/libutil/map.c
src/libutil/map_private.h

index e0859896987aefbad8c06b91c90fc5ae0fe1d9e4..54d3db2246a187b878b28b2dffaa2958b16e7503 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libserver/rspamd_control.h>
+#include <src/libutil/map_private.h>
 #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 */
index 892122ef06b1d35c2d680c5ec29b52ea88d4da64..892bf0e0cf1479ab62f808be9e3403208338aa18 100644 (file)
@@ -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);
 
index 79c3164e60538b8dcc9e924d288aeed17ad3199c..f1a9d22e47f3b2bbdcf216ed3ed585c271415aba 100644 (file)
@@ -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);