]> 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)
committerAndrew Lewis <nerf@judo.za.org>
Sat, 21 Oct 2017 19:03:22 +0000 (21:03 +0200)
MFH: rspamd-1.6

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

index 41f734593b3fbca708bfdd2e7176dad06413254e..2b28b58b4a7e8fb205aab5345a361f50b90beade 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"
@@ -2853,12 +2854,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 fab498ed375e4b9ace4c9871bf6ff9a3c8b49c91..cba9d798de3ae195163b8f81e45f1a0efa382f27 100644 (file)
@@ -1495,7 +1495,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);