]> source.dussan.org Git - rspamd.git/commitdiff
Finish history format rework.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 24 Oct 2015 22:02:59 +0000 (23:02 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 24 Oct 2015 22:02:59 +0000 (23:02 +0100)
conf/options.inc
doc/markdown/configuration/options.md
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c
src/rspamd.c

index fe8f56f8975f544cb3e0f8184aa36c8e46e279f0..186afbadedaa8bcec4e1611a934d13468e4cf7b7 100644 (file)
@@ -23,3 +23,4 @@ classify_headers = [
 ];
 
 control_socket = "$DBDIR/rspamd.sock mode=0600";
+history_rows = 200;
index 730a7996b0a7cbb6ef472c710e15c82e2bf2b82b..b503b98f3da5a228883d3e0e78eb9b2721b6fdab 100644 (file)
@@ -48,6 +48,7 @@ symbol).
 * `min_word_len`: minimum size in letters (valid for utf8 texts as well) for a sequence of characters to be treated as a word; normally rspamd skips sequences if they are shorter or equal to three symbols.
 * `control_socket`: path/bind credits for the control socket
 * `classify_headers`: list of headers that are processed by statistics
+* `history_rows`: number of rows in the recent history roll table
 
 ## DNS options
 
index 44b91505d80a7fb5837e0f0abdca3fe42aeec197..1fc5aee28c39771791a51c28c53073335443b374 100644 (file)
@@ -271,6 +271,7 @@ struct rspamd_config {
        gdouble upstream_revive_time;                                   /**< revive timeout for upstreams                                               */
 
        guint32 min_word_len;                                                   /**< minimum length of the word to be considered                */
+       guint history_rows;                                                             /**< number of history rows stored                                              */
 
        GList *classify_headers;                                                /**< list of headers using for statistics                               */
        struct module_s **compiled_modules;                             /**< list of compiled C modules                                                 */
index 596fff74a7be58ac994d4964c99adcc911c0a131..7180d8d70191b070228bb74d67bd58d17f18f1af 100644 (file)
@@ -1447,6 +1447,11 @@ rspamd_rcl_config_init (void)
                rspamd_rcl_parse_struct_string,
                G_STRUCT_OFFSET (struct rspamd_config, tld_file),
                RSPAMD_CL_FLAG_STRING_PATH);
+       rspamd_rcl_add_default_handler (sub,
+               "history_rows",
+               rspamd_rcl_parse_struct_integer,
+               G_STRUCT_OFFSET (struct rspamd_config, history_rows),
+               RSPAMD_CL_FLAG_UINT);
 
        /**
         * Metric section
index 5e3bf1561c25397a6dc47e6ee90b92f32d9a0741..3af15ab1daa52dd1910da5a87faed63cd74d3d29 100644 (file)
@@ -175,6 +175,7 @@ rspamd_config_defaults (struct rspamd_config *cfg)
 
        cfg->min_word_len = DEFAULT_MIN_WORD;
        cfg->dns_max_requests = 64;
+       cfg->history_rows = 200;
 }
 
 void
index 3609a3c5c36264c7a36bcdf0c8d69e1652d2c782..31d6dad78d7493899ce0f3582f61c6a3a82f2fb1 100644 (file)
@@ -816,8 +816,6 @@ main (gint argc, gchar **argv, gchar **env)
                        "main");
        rspamd_main->stat = rspamd_mempool_alloc0_shared (rspamd_main->server_pool,
                        sizeof (struct rspamd_stat));
-       /* Create rolling history */
-       rspamd_main->history = rspamd_roll_history_new (rspamd_main->server_pool);
        rspamd_main->cfg =
                        (struct rspamd_config *) g_malloc0 (sizeof (struct rspamd_config));
 
@@ -950,6 +948,10 @@ main (gint argc, gchar **argv, gchar **env)
                rspamd_main->cfg->log_level = G_LOG_LEVEL_DEBUG;
        }
 
+       /* Create rolling history */
+       rspamd_main->history = rspamd_roll_history_new (rspamd_main->server_pool,
+                       rspamd_main->cfg->history_rows);
+
        gperf_profiler_init (rspamd_main->cfg, "main");
 
        msg_info_main ("rspamd "