]> source.dussan.org Git - rspamd.git/commitdiff
More fixes to skipped tasks processing.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Sep 2013 12:08:26 +0000 (13:08 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Sep 2013 12:08:26 +0000 (13:08 +0100)
src/filter.c
src/worker.c

index 70857ee042214f2c91b38c1c50607835ee1acfae..1876344e1b6283a4e2e6fbbdfe3997fd13a4d027 100644 (file)
@@ -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;
        }
 
index 68ef89cb5ae039e405084cf334cbb11f4b82f91c..6974c8018401f2f1a96fd5c2f6f8790d0c8a8a18 100644 (file)
@@ -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;