aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-04 16:07:14 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-04 16:07:14 +0100
commit6a74976d4447f1cadba2b5f3a3c7847e4c9d27a8 (patch)
tree5b8333907e45b7f1e99c80223d945b77a4bc7e35 /src/worker.c
parent92b3c8a70c1bc48c6af43bdd988caab4bdaab075 (diff)
downloadrspamd-6a74976d4447f1cadba2b5f3a3c7847e4c9d27a8.tar.gz
rspamd-6a74976d4447f1cadba2b5f3a3c7847e4c9d27a8.zip
[Feature] Add magic for all workers' contexts
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/worker.c b/src/worker.c
index a4ef7a81a..8056b3f0f 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -32,6 +32,7 @@
#include "libstat/stat_api.h"
#include "libserver/worker_util.h"
#include "libserver/rspamd_control.h"
+#include "worker_private.h"
#include "utlist.h"
#include "lua/lua_common.h"
@@ -70,44 +71,6 @@ worker_t normal_worker = {
G_STRFUNC, \
__VA_ARGS__)
-struct rspamd_worker_log_pipe {
- gint fd;
- enum rspamd_log_pipe_type type;
- struct rspamd_worker_log_pipe *prev, *next;
-};
-
-/*
- * Worker's context
- */
-struct rspamd_worker_ctx {
- guint32 timeout;
- struct timeval io_tv;
- /* Detect whether this worker is mime worker */
- gboolean is_mime;
- /* HTTP worker */
- gboolean is_http;
- /* JSON output */
- gboolean is_json;
- /* Allow learning throught worker */
- gboolean allow_learn;
- /* DNS resolver */
- struct rspamd_dns_resolver *resolver;
- /* Limit of tasks */
- guint32 max_tasks;
- /* Maximum time for task processing */
- gdouble task_timeout;
- /* Events base */
- struct event_base *ev_base;
- /* Encryption key */
- struct rspamd_cryptobox_keypair *key;
- /* Keys cache */
- struct rspamd_keypair_cache *keys_cache;
- /* Configuration */
- struct rspamd_config *cfg;
- /* Log pipe */
- struct rspamd_worker_log_pipe *log_pipes;
-};
-
/*
* Reduce number of tasks proceeded
*/
@@ -436,6 +399,7 @@ init_worker (struct rspamd_config *cfg)
ctx = g_malloc0 (sizeof (struct rspamd_worker_ctx));
+ ctx->magic = rspamd_worker_magic;
ctx->is_mime = TRUE;
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
ctx->cfg = cfg;