]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix new rrd updates
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 Jan 2017 13:32:14 +0000 (13:32 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 Jan 2017 13:32:14 +0000 (13:32 +0000)
src/controller.c
src/rspamd.h

index 16bbaff1040bcd6ea745b3503b61087a1ab2cfa2..cfb2df3a96506aa7fd33fae97925f2f06e8e0422 100644 (file)
@@ -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;
index bb7285dff56d1fa2910849a04683d83d4a891a5f..8551b988dd2335a17435b74c5ed2c3bae04c7ff1 100644 (file)
@@ -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                                                               */