aboutsummaryrefslogtreecommitdiffstats
path: root/src/classifiers/winnow.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-28 19:11:05 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-28 19:11:05 +0400
commitee3d2182e1ce2a65822ac5a7dc51201a7c8b327d (patch)
treef8d9de66f3d7bb77ce7e571bf210a40a91d67ea3 /src/classifiers/winnow.c
parente1fea1e66d0f1111e934bb0e86bd2ce25da6df6e (diff)
downloadrspamd-ee3d2182e1ce2a65822ac5a7dc51201a7c8b327d.tar.gz
rspamd-ee3d2182e1ce2a65822ac5a7dc51201a7c8b327d.zip
* Fix race between learn and classify
Diffstat (limited to 'src/classifiers/winnow.c')
-rw-r--r--src/classifiers/winnow.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c
index 6abd973ed..0b156176e 100644
--- a/src/classifiers/winnow.c
+++ b/src/classifiers/winnow.c
@@ -126,7 +126,11 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t *pool, GTree *input
}
}
- g_tree_foreach (input, classify_callback, &data);
+ if (data.file != NULL) {
+ statfile_pool_lock_file (pool, data.file);
+ g_tree_foreach (input, classify_callback, &data);
+ statfile_pool_unlock_file (pool, data.file);
+ }
if (data.count != 0) {
*res = (data.sum / data.count);