diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-13 19:09:27 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-13 19:09:27 +0400 |
commit | 0d64c808b7310b6e233ec570649fbb281a3f2b13 (patch) | |
tree | bec667c9c350cc53dcd05e7779988486778c64c9 /src/worker.c | |
parent | b5f2b43a8d1fc3361dc1665c62b2a44d66c01474 (diff) | |
download | rspamd-0d64c808b7310b6e233ec570649fbb281a3f2b13.tar.gz rspamd-0d64c808b7310b6e233ec570649fbb281a3f2b13.zip |
Add quarks to events to determine source of event inside rspamd.
Another try to fix threading.
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/worker.c b/src/worker.c index 28bdb7100..f113e04d9 100644 --- a/src/worker.c +++ b/src/worker.c @@ -506,12 +506,11 @@ read_socket (f_str_t * in, void *arg) } /* Add task to classify to classify pool */ if (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); - } - else { - register_async_thread (task->s); + remove_async_thread (task->s); } } } @@ -636,12 +635,14 @@ fin_task (void *arg) } /* Check if we have all events finished */ - task->state = WRITE_REPLY; - if (task->fin_callback) { - task->fin_callback (task->fin_arg); - } - else { - rspamd_dispatcher_restore (task->dispatcher); + if (g_hash_table_size (task->s->events) == 0 && task->s->threads == 0) { + task->state = WRITE_REPLY; + if (task->fin_callback) { + task->fin_callback (task->fin_arg); + } + else { + rspamd_dispatcher_restore (task->dispatcher); + } } } @@ -655,6 +656,7 @@ restore_task (void *arg) /* Special state */ task->state = WAIT_POST_FILTER; + task->s->wanna_die = TRUE; } /* |