aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-03 13:32:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-03 13:32:14 +0000
commit755e765515eebec9215e48f46f635bb2a2d54d11 (patch)
tree8399028a809cc5e22c48de44ca1beffdf50b6614 /src
parente5a9a2248124f691d8ee9e27db623fa17278af3e (diff)
downloadrspamd-755e765515eebec9215e48f46f635bb2a2d54d11.tar.gz
rspamd-755e765515eebec9215e48f46f635bb2a2d54d11.zip
[Fix] Fix new rrd updates
Diffstat (limited to 'src')
-rw-r--r--src/controller.c23
-rw-r--r--src/rspamd.h2
2 files changed, 5 insertions, 20 deletions
diff --git a/src/controller.c b/src/controller.c
index 16bbaff10..cfb2df3a9 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -2563,31 +2563,16 @@ rspamd_controller_rrd_update (gint fd, short what, void *arg)
struct rspamd_controller_worker_ctx *ctx = arg;
struct rspamd_stat *stat;
GArray ar;
- gdouble points[4];
+ gdouble points[METRIC_ACTION_MAX];
GError *err = NULL;
- guint i, j;
+ guint i;
gdouble val;
g_assert (ctx->rrd != NULL);
stat = ctx->srv->stat;
- for (i = METRIC_ACTION_REJECT, j = 0;
- i <= METRIC_ACTION_NOACTION && j < G_N_ELEMENTS (points);
- i++) {
- switch (i) {
- case METRIC_ACTION_SOFT_REJECT:
- break;
- case METRIC_ACTION_REWRITE_SUBJECT:
- val = stat->actions_stat[i];
- break;
- case METRIC_ACTION_ADD_HEADER:
- val += stat->actions_stat[i];
- points[j++] = val;
- break;
- default:
- val = stat->actions_stat[i];
- points[j++] = val;
- }
+ for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i ++) {
+ points[i] = stat->actions_stat[i];
}
ar.data = (gchar *)points;
diff --git a/src/rspamd.h b/src/rspamd.h
index bb7285dff..8551b988d 100644
--- a/src/rspamd.h
+++ b/src/rspamd.h
@@ -222,7 +222,7 @@ struct rspamd_cryptobox_library_ctx;
*/
struct rspamd_stat {
guint messages_scanned; /**< total number of messages scanned */
- guint actions_stat[METRIC_ACTION_NOACTION + 1]; /**< statistic for each action */
+ guint actions_stat[METRIC_ACTION_MAX]; /**< statistic for each action */
guint connections_count; /**< total connections count */
guint control_connections_count; /**< connections count to control interface */
guint messages_learned; /**< messages learned */