]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Write to stat after scanning.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 14:12:07 +0000 (15:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 14:12:07 +0000 (15:12 +0100)
src/libserver/protocol.c

index df5e9723e70537f3ac7b8b51bcccd4e5646b44c6..6f22b5f34bb71e83c91abc86986faf49a874f357 100644 (file)
@@ -702,6 +702,8 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg, struct rspamd_task
        GHashTableIter                   hiter;
        gpointer                         h, v;
        ucl_object_t                    *top = NULL, *obj;
+       gdouble                          required_score;
+       gint                             action;
 
        /* Output the first line - check status */
        logbuf = g_string_sized_new (BUFSIZ);
@@ -754,6 +756,17 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg, struct rspamd_task
        }
        ucl_object_unref (top);
 
+       /* Update stat for default metric */
+       metric_res = g_hash_table_lookup (task->results, DEFAULT_METRIC);
+       if (metric_res != NULL) {
+               required_score = metric_res->metric->actions[METRIC_ACTION_REJECT].score;
+               action = check_metric_action (metric_res->score, required_score,
+                               metric_res->metric);
+               if (action <= METRIC_ACTION_NOACTION) {
+                       task->worker->srv->stat->actions_stat[action] ++;
+               }
+       }
+
        /* Increase counters */
        task->worker->srv->stat->messages_scanned++;
 }