]> source.dussan.org Git - rspamd.git/commitdiff
* In classify normalize result after comparing, not before
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 27 May 2010 15:16:13 +0000 (19:16 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 27 May 2010 15:16:13 +0000 (19:16 +0400)
src/classifiers/winnow.c
src/statfile.c

index 1d48cc2ba0a282171c20b557738364e8f2aff3c8..78e05d43b531a5a0a79b29a55693e108ba731d6c 100644 (file)
@@ -232,9 +232,6 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp
 
                if (data.count != 0) {
                        res = data.sum / data.count;
-            if (st->normalizer != NULL) {
-                res = st->normalizer (task->cfg, res, st->normalizer_data);
-            }
                }
                else {
                        res = 0;
@@ -253,6 +250,9 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp
 #ifdef WITH_LUA
         max = call_classifier_post_callbacks (ctx->cfg, task, max);
 #endif
+               if (st->normalizer != NULL) {
+                       max = st->normalizer (task->cfg, max, st->normalizer_data);
+               }
                insert_result (task, ctx->cfg->metric, sel->symbol, max, cur);
        }
 }
index 1e47b3ec7245fc9ad925190bf74839af7924bffc..005ea7c8a23a7ce503b88f4d1af847c99167b25a 100644 (file)
@@ -365,7 +365,7 @@ statfile_pool_open (statfile_pool_t * pool, char *filename, size_t size, gboolea
        qsort (pool->files, pool->opened, sizeof (stat_file_t), cmpstatfile);
        memory_pool_unlock_mutex (pool->lock);
 
-       return new_file;
+       return statfile_pool_is_open (pool, filename);
 }
 
 int