aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-22 14:43:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-22 14:43:00 +0100
commit7de497b731406b0dceba4a86075d4086f5bd936a (patch)
tree4921a21cf035a999bc07785aa7c7a960e1c2787e /src/worker.c
parente6d42dffd5367ca97a09167194f027727313af59 (diff)
downloadrspamd-7de497b731406b0dceba4a86075d4086f5bd936a.tar.gz
rspamd-7de497b731406b0dceba4a86075d4086f5bd936a.zip
Unify task scan functions.
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/src/worker.c b/src/worker.c
index 94ec74451..9f6e269bb 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -170,8 +170,6 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn,
{
struct rspamd_task *task = (struct rspamd_task *) conn->ud;
struct rspamd_worker_ctx *ctx;
- ssize_t r;
- GError *err = NULL;
ctx = task->worker->ctx;
@@ -193,58 +191,8 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn,
return 0;
}
- task->msg = msg->body;
+ rspamd_task_process (task, msg, ctx->classify_pool, TRUE);
- debug_task ("got string of length %z", task->msg->len);
-
- /* We got body, set wanna_die flag */
- task->s->wanna_die = TRUE;
-
- r = process_message (task);
- if (r == -1) {
- msg_warn ("processing of message failed");
- task->last_error = "MIME processing error";
- task->error_code = RSPAMD_FILTER_ERROR;
- task->state = WRITE_REPLY;
- return 0;
- }
- if (task->cmd == CMD_OTHER) {
- /* Skip filters */
- task->state = WRITE_REPLY;
- return 0;
- }
- else {
- if (task->cfg->pre_filters == NULL) {
- r = process_filters (task);
- if (r == -1) {
- task->last_error = "filter processing error";
- task->error_code = RSPAMD_FILTER_ERROR;
- task->state = WRITE_REPLY;
- return 0;
- }
- /* Add task to classify to classify pool */
- if (!task->is_skipped && ctx->classify_pool) {
- register_async_thread (task->s);
- g_thread_pool_push (ctx->classify_pool, task, &err);
- if (err != NULL) {
- msg_err ("cannot pull task to the pool: %s", err->message);
- remove_async_thread (task->s);
- }
- }
- if (task->is_skipped) {
- /* Call write_socket to write reply and exit */
- task->state = WRITE_REPLY;
- return 0;
- }
- }
- else {
- lua_call_pre_filters (task);
- /* We want fin_task after pre filters are processed */
- task->s->wanna_die = TRUE;
- task->state = WAIT_PRE_FILTER;
- check_session_pending (task->s);
- }
- }
return 0;
}
@@ -329,7 +277,6 @@ accept_socket (gint fd, short what, void *arg)
/* Copy some variables */
new_task->sock = nfd;
new_task->is_mime = ctx->is_mime;
- new_task->allow_learn = ctx->allow_learn;
memcpy (&new_task->client_addr, &addr, sizeof (addr));
worker->srv->stat->connections_count++;