diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-26 13:05:08 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-26 13:05:08 +0000 |
commit | 723f7fd52754d49244ddd8373a0fc4b0f3bc44d1 (patch) | |
tree | 3d93c44308ef67837bb893902d3fc1c830b7a033 /src/libstat/stat_process.c | |
parent | b1eed8e17a5e7a97533a0836e0c2f091bb1c9393 (diff) | |
download | rspamd-723f7fd52754d49244ddd8373a0fc4b0f3bc44d1.tar.gz rspamd-723f7fd52754d49244ddd8373a0fc4b0f3bc44d1.zip |
Write statfiles revisions to the runtime.
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r-- | src/libstat/stat_process.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 0151bb979..524640e4e 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -98,7 +98,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx, gpointer backend_runtime; GList *cur, *st_list = NULL, *curst; GList *cl_runtimes = NULL; - guint result_size = 0; + guint result_size = 0, start_pos = 0, end_pos = 0; struct preprocess_cb_data cbdata; cur = g_list_first (task->cfg->classifiers); @@ -131,7 +131,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx, cl_runtime->clcf = clcf; - curst = clcf->statfiles; + curst = st_list; while (curst != NULL) { stcf = (struct rspamd_statfile_config *)curst->data; @@ -151,11 +151,21 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx, st_runtime->backend_runtime = backend_runtime; st_runtime->backend = bk; + if (stcf->is_spam) { + cl_runtime->total_spam += bk->total_learns (backend_runtime, + bk->ctx); + } + else { + cl_runtime->total_ham += bk->total_learns (backend_runtime, + bk->ctx); + } + cl_runtime->st_runtime = g_list_prepend (cl_runtime->st_runtime, st_runtime); result_size ++; curst = g_list_next (curst); + end_pos ++; } if (cl_runtime->st_runtime != NULL) { @@ -165,6 +175,13 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx, cl_runtimes = g_list_prepend (cl_runtimes, cl_runtime); } + /* Set positions in the results array */ + cl_runtime->start_pos = start_pos; + cl_runtime->end_pos = end_pos; + + start_pos = end_pos; + + /* Next classifier */ cur = g_list_next (cur); } |