diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-19 08:15:52 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-19 08:15:52 +0100 |
commit | 8fb06a8fe1ec7e3c96baa98085b7da6bbb07db03 (patch) | |
tree | b394fa1320e479f29a7f4e09e8c65e92e47e18ef /src/libserver | |
parent | 9cfaba2d31af21c5f614b923563b37246f5a7566 (diff) | |
download | rspamd-8fb06a8fe1ec7e3c96baa98085b7da6bbb07db03.tar.gz rspamd-8fb06a8fe1ec7e3c96baa98085b7da6bbb07db03.zip |
[Feature] Allow to disable specific workers in the config
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 6 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 89f4f0fde..3c5fe93fb 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -198,6 +198,7 @@ struct rspamd_worker_conf { gpointer *ctx; /**< worker's context */ ucl_object_t *options; /**< other worker's options */ struct rspamd_worker_lua_script *scripts; /**< registered lua scripts */ + gboolean enabled; ref_entry_t ref; }; diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index d8fc1c764..bf3a1779f 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -2400,6 +2400,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg) G_STRUCT_OFFSET (struct rspamd_worker_conf, rlimit_maxcore), RSPAMD_CL_FLAG_INT_32, "Max size of core file in bytes"); + rspamd_rcl_add_default_handler (sub, + "enabled", + rspamd_rcl_parse_struct_boolean, + G_STRUCT_OFFSET (struct rspamd_worker_conf, enabled), + 0, + "Enable or disable a worker (true by default)"); /** * Modules handler diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 2791c28d4..4966c37d6 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -987,6 +987,7 @@ rspamd_config_new_worker (struct rspamd_config *cfg, #endif c->rlimit_nofile = 0; c->rlimit_maxcore = 0; + c->enabled = TRUE; REF_INIT_RETAIN (c, rspamd_worker_conf_dtor); rspamd_mempool_add_destructor (cfg->cfg_pool, |