summaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-31 17:35:35 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-31 17:35:35 +0400
commita93dd7892f8ecf0a72a242d2d203575001ef635e (patch)
tree43aaac84ff4f7059f2c89b425f47e341b6c3211e /src/worker.c
parent37d6c7f23fd44283d1853141d39ecc3f3a2c54e6 (diff)
downloadrspamd-a93dd7892f8ecf0a72a242d2d203575001ef635e.tar.gz
rspamd-a93dd7892f8ecf0a72a242d2d203575001ef635e.zip
* Preload statfiles at the early beginning in the main process
* Add JSON output for rspamd worker * Add HTTP protocol support for rspamd worker
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/worker.c b/src/worker.c
index f9a6f936e..57ad4ecf1 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -81,10 +81,14 @@ struct custom_filter {
struct rspamd_worker_ctx {
guint32 timeout;
struct timeval io_tv;
- /* Detect whether this worker is mime worker */
+ /* Detect whether this worker is mime worker */
gboolean is_mime;
- /* Detect whether this worker is mime worker */
+ /* Detect whether this worker is custom worker */
gboolean is_custom;
+ /* HTTP worker */
+ gboolean is_http;
+ /* JSON output */
+ gboolean is_json;
GList *custom_filters;
/* DNS resolver */
struct rspamd_dns_resolver *resolver;
@@ -327,7 +331,7 @@ read_socket (f_str_t * in, void *arg)
}
}
else {
- if (read_rspamd_input_line (task, in) != 0) {
+ if (!read_rspamd_input_line (task, in)) {
task->last_error = "Read error";
task->error_code = RSPAMD_NETWORK_ERROR;
task->state = WRITE_ERROR;
@@ -603,6 +607,9 @@ accept_socket (gint fd, short what, void *arg)
new_task->sock = nfd;
new_task->is_mime = ctx->is_mime;
+ new_task->is_json = ctx->is_json;
+ new_task->is_http = ctx->is_http;
+
worker->srv->stat->connections_count++;
new_task->resolver = ctx->resolver;
msec_to_tv (ctx->timeout, &ctx->io_tv);
@@ -741,6 +748,8 @@ init_worker (void)
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
register_worker_opt (TYPE_WORKER, "mime", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_mime));
+ register_worker_opt (TYPE_WORKER, "http", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_http));
+ register_worker_opt (TYPE_WORKER, "json", xml_handle_boolean, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, is_json));
register_worker_opt (TYPE_WORKER, "timeout", xml_handle_seconds, ctx, G_STRUCT_OFFSET (struct rspamd_worker_ctx, timeout));
return ctx;