aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-11 13:08:26 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-11 13:08:26 +0100
commitd218a287788d3040ce5b31e2904641c69c7f49b9 (patch)
tree189c3aaf406690a3dce3ba9375f7ccd63901b37c
parent150915d96eb1f2e0fb6709276e2209b0b00a5cfe (diff)
downloadrspamd-d218a287788d3040ce5b31e2904641c69c7f49b9.tar.gz
rspamd-d218a287788d3040ce5b31e2904641c69c7f49b9.zip
More fixes to skipped tasks processing.
-rw-r--r--src/filter.c1
-rw-r--r--src/worker.c17
2 files changed, 17 insertions, 1 deletions
diff --git a/src/filter.c b/src/filter.c
index 70857ee04..1876344e1 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -733,6 +733,7 @@ process_statfiles_threaded (gpointer data, gpointer user_data)
struct classifiers_cbdata cbdata;
if (task->is_skipped) {
+ remove_async_thread (task->s);
return;
}
diff --git a/src/worker.c b/src/worker.c
index 68ef89cb5..6974c8018 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -381,7 +381,7 @@ read_socket (f_str_t * in, void *arg)
return write_socket (task);
}
/* Add task to classify to classify pool */
- if (ctx->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) {
@@ -527,6 +527,19 @@ fin_task (void *arg)
ctx = task->worker->ctx;
+
+ /* Task is already finished or skipped */
+ if (task->state == WRITE_REPLY) {
+ if (task->fin_callback) {
+ task->fin_callback (task->fin_arg);
+ }
+ else {
+ rspamd_dispatcher_restore (task->dispatcher);
+ }
+ return TRUE;
+ }
+
+ /* We processed all filters and want to process statfiles */
if (task->state != WAIT_POST_FILTER && task->state != WAIT_PRE_FILTER) {
/* Process all statfiles */
if (ctx->classify_pool == NULL) {
@@ -546,6 +559,7 @@ fin_task (void *arg)
}
+ /* We are on post-filter waiting state */
if (task->state != WAIT_PRE_FILTER) {
/* Check if we have all events finished */
task->state = WRITE_REPLY;
@@ -557,6 +571,7 @@ fin_task (void *arg)
}
}
else {
+ /* We were waiting for pre-filter */
if (task->pre_result.action != METRIC_ACTION_NOACTION) {
/* Write result based on pre filters */
task->state = WRITE_REPLY;