]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add common directory for hyperscan cache to config
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Apr 2016 17:27:51 +0000 (18:27 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Apr 2016 17:27:51 +0000 (18:27 +0100)
conf/options.inc
src/hs_helper.c
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c

index d9b48a51e89a46e286eaa8bc0802a3347cedba3c..318de7554f6b15b1b79a6f07767b56d562126054 100644 (file)
@@ -35,3 +35,4 @@ words_decay = 200;
 
 # Local networks
 local_addrs = "192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, fd00::/8, 169.254.0.0/16, fe80::/10";
+hs_cache_dir = "${DBDIR}/";
index 1434f551af9401d53c9fb8a8681ee5c9f914af82..1292d6460c7ef856921154f6e8dd98baf63e8c7d 100644 (file)
@@ -66,7 +66,7 @@ init_hs_helper (struct rspamd_config *cfg)
 
        ctx->magic = rspamd_hs_helper_magic;
        ctx->cfg = cfg;
-       ctx->hs_dir = RSPAMD_DBDIR "/";
+       ctx->hs_dir = NULL;
        ctx->max_time = default_max_time;
        ctx->recompile_time = default_recompile_time;
 
@@ -249,6 +249,14 @@ start_hs_helper (struct rspamd_worker *worker)
        struct timeval tv;
        double tim;
 
+
+       if (ctx->hs_dir == NULL) {
+               ctx->hs_dir = ctx->cfg->hs_cache_dir;
+       }
+       if (ctx->hs_dir == NULL) {
+               ctx->hs_dir = RSPAMD_DBDIR "/";
+       }
+
        ctx->ev_base = rspamd_prepare_worker (worker,
                        "hs_helper",
                        NULL);
index 0986ed03559d4a1c729af4a82c2f5543f90c05cf..67749c27641dc7971f3030a1bf38944b31a750b4 100644 (file)
@@ -368,6 +368,8 @@ struct rspamd_config {
 
        gchar * tld_file;                               /**< file to load effective tld list from                               */
 
+       gchar * hs_cache_dir;                           /**< directory to save hyperscan databases                              */
+
        gdouble dns_timeout;                            /**< timeout in milliseconds for waiting for dns reply  */
        guint32 dns_retransmits;                        /**< maximum retransmits count                                                  */
        guint32 dns_throttling_errors;                  /**< maximum errors for starting resolver throttling    */
index 288b8a5051588c8e51f0a7e0e439cf2e7116278c..7441e5bf0b2ca7afd56177a90b4099c4f050d5dd 100644 (file)
@@ -1779,6 +1779,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        G_STRUCT_OFFSET (struct rspamd_config, tld_file),
                        RSPAMD_CL_FLAG_STRING_PATH,
                        "Path to the TLD file for urls detector");
+       rspamd_rcl_add_default_handler (sub,
+                       "hs_cache_dir",
+                       rspamd_rcl_parse_struct_string,
+                       G_STRUCT_OFFSET (struct rspamd_config, hs_cache_dir),
+                       RSPAMD_CL_FLAG_STRING_PATH,
+                       "Path directory where rspamd would save hyperscan cache");
        rspamd_rcl_add_default_handler (sub,
                        "history_rows",
                        rspamd_rcl_parse_struct_integer,