From: Vsevolod Stakhov Date: Fri, 2 May 2014 14:12:07 +0000 (+0100) Subject: Write to stat after scanning. X-Git-Tag: 0.7.0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=392e39b893d0fe19b764f70bc369edd92bacd76d;p=thirdparty%2Frspamd.git Write to stat after scanning. --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index df5e9723e7..6f22b5f34b 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -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++; }