aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-29 18:39:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-29 18:39:42 +0000
commit4acd548e912089493d5eaaeeff58c398d943c5e8 (patch)
tree34166bcf921a228edf90c43d514d0e067e8a045e /src/worker.c
parentebc0a487e134164469b34c87848836d601f54eaf (diff)
downloadrspamd-4acd548e912089493d5eaaeeff58c398d943c5e8.tar.gz
rspamd-4acd548e912089493d5eaaeeff58c398d943c5e8.zip
Add support of encryption to the worker.
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/worker.c b/src/worker.c
index 62a129235..0a6ce4a5e 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -86,6 +86,8 @@ struct rspamd_worker_ctx {
GThreadPool *classify_pool;
/* Events base */
struct event_base *ev_base;
+ /* Encryption key */
+ gpointer key;
};
/*
@@ -243,6 +245,10 @@ accept_socket (gint fd, short what, void *arg)
new_task->classify_pool = ctx->classify_pool;
+ if (ctx->key) {
+ rspamd_http_connection_set_key (new_task->http_conn, ctx->key);
+ }
+
rspamd_http_connection_read_message (new_task->http_conn,
new_task,
nfd,
@@ -295,6 +301,12 @@ init_worker (struct rspamd_config *cfg)
G_STRUCT_OFFSET (struct rspamd_worker_ctx,
classify_threads), RSPAMD_CL_FLAG_INT_32);
+
+ rspamd_rcl_register_worker_option (cfg, type, "keypair",
+ rspamd_rcl_parse_struct_keypair, ctx,
+ G_STRUCT_OFFSET (struct rspamd_worker_ctx,
+ key), 0);
+
return ctx;
}
@@ -340,6 +352,11 @@ start_worker (struct rspamd_worker *worker)
g_mime_shutdown ();
rspamd_log_close (rspamd_main->logger);
+
+ if (ctx->key) {
+ rspamd_http_connection_key_destroy (ctx->key);
+ }
+
exit (EXIT_SUCCESS);
}