aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-30 16:56:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-30 16:56:37 +0100
commita932b82cdc9c1b6f3b81f18ed27305e3243df698 (patch)
tree4dcb813fa2c166b25db6a7450910d07b80921601 /src/worker.c
parentc0bc9903bf233ecc1931ece16109c8a8c07db0b6 (diff)
downloadrspamd-a932b82cdc9c1b6f3b81f18ed27305e3243df698.tar.gz
rspamd-a932b82cdc9c1b6f3b81f18ed27305e3243df698.zip
Adopt normal worker for new params parsing.
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/worker.c b/src/worker.c
index f27c6c2a9..2149639de 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -47,7 +47,7 @@
/* 60 seconds for worker's IO */
#define DEFAULT_WORKER_IO_TIMEOUT 60000
-gpointer init_worker (void);
+gpointer init_worker (struct config_file *cfg);
void start_worker (struct rspamd_worker *worker);
worker_t normal_worker = {
@@ -810,7 +810,7 @@ unload_custom_filters (struct rspamd_worker_ctx *ctx)
#endif
gpointer
-init_worker (void)
+init_worker (struct config_file *cfg)
{
struct rspamd_worker_ctx *ctx;
GQuark type;
@@ -823,13 +823,33 @@ init_worker (void)
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
ctx->classify_threads = 1;
- register_worker_opt (type, "mime", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_mime));
- register_worker_opt (type, "http", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_http));
- register_worker_opt (type, "json", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_json));
- register_worker_opt (type, "allow_learn", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, allow_learn));
- register_worker_opt (type, "timeout", xml_handle_seconds, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, timeout));
- register_worker_opt (type, "max_tasks", xml_handle_uint32, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, max_tasks));
- register_worker_opt (type, "classify_threads", xml_handle_uint32, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, classify_threads));
+ rspamd_rcl_register_worker_option (cfg, type, "mime",
+ rspamd_rcl_parse_struct_boolean, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_mime), 0);
+
+ rspamd_rcl_register_worker_option (cfg, type, "http",
+ rspamd_rcl_parse_struct_boolean, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_http), 0);
+
+ rspamd_rcl_register_worker_option (cfg, type, "json",
+ rspamd_rcl_parse_struct_boolean, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_json), 0);
+
+ rspamd_rcl_register_worker_option (cfg, type, "allow_learn",
+ rspamd_rcl_parse_struct_boolean, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, allow_learn), 0);
+
+ rspamd_rcl_register_worker_option (cfg, type, "timeout",
+ rspamd_rcl_parse_struct_time, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, timeout), RSPAMD_CL_FLAG_TIME_INTEGER);
+
+ rspamd_rcl_register_worker_option (cfg, type, "max_tasks",
+ rspamd_rcl_parse_struct_integer, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, max_tasks), RSPAMD_CL_FLAG_INT_32);
+
+ rspamd_rcl_register_worker_option (cfg, type, "classify_threads",
+ rspamd_rcl_parse_struct_integer, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx, classify_threads), RSPAMD_CL_FLAG_INT_32);
return ctx;
}