]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add configuration knobs for sessions cache
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 4 Jul 2017 07:33:00 +0000 (08:33 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 4 Jul 2017 07:33:00 +0000 (08:33 +0100)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c

index e48eb6db0256990db26a0780bf4ea0f71928ca51..8c7b392621729c171c357b47edee5750241dded5 100644 (file)
@@ -308,6 +308,7 @@ struct rspamd_config {
        gboolean ignore_received;                       /**< Ignore data from the first received header                 */
        gboolean check_local;                           /** Don't disable any checks for local networks */
        gboolean check_authed;                          /** Don't disable any checks for authenticated users */
+       gboolean enable_sessions_cache;                 /**< Enable session cache for debug */
 
        gsize max_diff;                                 /**< maximum diff size for text parts                                   */
        gsize max_cores_size;                           /**< maximum size occupied by rspamd core files                 */
@@ -411,6 +412,7 @@ struct rspamd_config {
        guint max_word_len;                                                             /**< maximum length of the word to be considered                */
        guint words_decay;                                                              /**< limit for words for starting adaptive ignoring             */
        guint history_rows;                                                             /**< number of history rows stored                                              */
+       guint max_session_cache;                        /**< maximum number of sessions cache elts                              */
 
        GList *classify_headers;                                                /**< list of headers using for statistics                               */
        struct module_s **compiled_modules;                             /**< list of compiled C modules                                                 */
index bf3a1779f01e3d19288cbe7352e73c8ae8cdd17f..f4ca6ded7e3d742dda8424c287dad694eeabe16a 100644 (file)
@@ -2199,6 +2199,18 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        G_STRUCT_OFFSET (struct rspamd_config, default_max_shots),
                        0,
                        "Maximum number of hits per a single symbol (default: 100)");
+       rspamd_rcl_add_default_handler (sub,
+                       "sessions_cache",
+                       rspamd_rcl_parse_struct_boolean,
+                       G_STRUCT_OFFSET (struct rspamd_config, enable_sessions_cache),
+                       0,
+                       "Enable sessions cache to debug dangling sessions");
+       rspamd_rcl_add_default_handler (sub,
+                       "max_session_cache",
+                       rspamd_rcl_parse_struct_integer,
+                       G_STRUCT_OFFSET (struct rspamd_config, max_session_cache),
+                       0,
+                       "Maximum number of sessions in cache before warning (default: 100)");
 
        /* Neighbours configuration */
        rspamd_rcl_add_section_doc (&sub->subsections, "neighbours", "name",
index 4966c37d64d57fad38573b79aa76054b4268b5c2..abc647dcba1bdae9dda1bedb50039f09772f00d7 100644 (file)
@@ -42,6 +42,7 @@
 #define DEFAULT_MAX_MESSAGE (50 * 1024 * 1024)
 #define DEFAULT_MAX_PIC (1 * 1024 * 1024)
 #define DEFAULT_MAX_SHOTS 100
+#define DEFAULT_MAX_SESSIONS 100
 
 struct rspamd_ucl_map_cbdata {
        struct rspamd_config *cfg;
@@ -181,6 +182,7 @@ rspamd_config_new (void)
        cfg->redis_pool = rspamd_redis_pool_init ();
 #endif
        cfg->default_max_shots = DEFAULT_MAX_SHOTS;
+       cfg->max_session_cache = DEFAULT_MAX_SESSIONS;
 
        REF_INIT_RETAIN (cfg, rspamd_config_free);