aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-27 15:28:13 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-27 15:28:13 +0000
commitd578517d8ced7b9c32b98de4873d68c2a4cecb75 (patch)
tree81878b7b38b0a5c6ec5b901f7225708704ed2ce5
parent306d01b6fcf560a1905164e7f428c9989ac4e5fc (diff)
downloadrspamd-d578517d8ced7b9c32b98de4873d68c2a4cecb75.tar.gz
rspamd-d578517d8ced7b9c32b98de4873d68c2a4cecb75.zip
Fix multiple classifiers support.
-rw-r--r--src/libstat/stat_process.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index c0aad1930..419827aeb 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -515,16 +515,25 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
}
if (cl_runtimes != NULL) {
+ /* Reverse list as we have used g_list_prepend */
+ cl_runtimes = g_list_reverse (cl_runtimes);
rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t)g_list_free,
+ (rspamd_mempool_destruct_t) g_list_free,
cl_runtimes);
+ cur = g_list_first (cl_runtimes);
- cbdata.results_count = result_size;
- cbdata.classifier_runtimes = cl_runtimes;
- cbdata.task = task;
- cbdata.tok = cl_runtime->tok;
- g_tree_foreach (cbdata.tok->tokens, preprocess_init_stat_token,
- &cbdata);
+ while (cur) {
+ cl_runtime = cur->data;
+
+ cbdata.results_count = result_size;
+ cbdata.classifier_runtimes = cl_runtimes;
+ cbdata.task = task;
+ cbdata.tok = cl_runtime->tok;
+ g_tree_foreach (cbdata.tok->tokens, preprocess_init_stat_token,
+ &cbdata);
+
+ cur = g_list_next (cur);
+ }
}
else if (classifier != NULL) {
/* We likely cannot find any classifier with this name */