src/daemon/plugin.h: Change "values_len" to type "size_t".
[collectd.git] / src / write_riemann.c
index 0a8df6f..93bf853 100644 (file)
@@ -778,35 +778,33 @@ static int riemann_notification(const notification_t *n, user_data_t *ud) /* {{{
 } /* }}} int riemann_notification */
 
 static int riemann_write(const data_set_t *ds, /* {{{ */
-             const value_list_t *vl,
-             user_data_t *ud)
+               const value_list_t *vl,
+               user_data_t *ud)
 {
        int                      status = 0;
        int                      statuses[vl->values_len];
        struct riemann_host     *host = ud->data;
-       Msg                     *msg;
-
-       if (host->check_thresholds)
-               write_riemann_threshold_check(ds, vl, statuses);
-
-    if (host->use_tcp == 1 && host->batch_mode) {
-
-        riemann_batch_add_value_list (host, ds, vl, statuses);
 
+       if (host->check_thresholds) {
+               status = write_riemann_threshold_check(ds, vl, statuses);
+               if (status != 0)
+                       return status;
+       }
 
-    } else {
+       if (host->use_tcp == 1 && host->batch_mode) {
+               riemann_batch_add_value_list (host, ds, vl, statuses);
+       } else {
+               Msg *msg = riemann_value_list_to_protobuf (host, ds, vl, statuses);
+               if (msg == NULL)
+                       return (-1);
 
-        msg = riemann_value_list_to_protobuf (host, ds, vl, statuses);
-        if (msg == NULL)
-            return (-1);
+               status = riemann_send (host, msg);
+               if (status != 0)
+                       ERROR ("write_riemann plugin: riemann_send failed with status %i", status);
 
-        status = riemann_send (host, msg);
-        if (status != 0)
-            ERROR ("write_riemann plugin: riemann_send failed with status %i",
-                   status);
+               riemann_msg_protobuf_free (msg);
+       }
 
-        riemann_msg_protobuf_free (msg);
-    }
        return status;
 } /* }}} int riemann_write */
 
@@ -854,10 +852,10 @@ static int riemann_config_node(oconfig_item_t *ci) /* {{{ */
        host->check_thresholds = 0;
        host->store_rates = 1;
        host->always_append_ds = 0;
-       host->use_tcp = 0;
-    host->batch_mode = 0;
-    host->batch_max = RIEMANN_BATCH_MAX; /* typical MSS */
-    host->batch_init = cdtime();
+       host->use_tcp = 1;
+       host->batch_mode = 1;
+       host->batch_max = RIEMANN_BATCH_MAX; /* typical MSS */
+       host->batch_init = cdtime();
        host->ttl_factor = RIEMANN_TTL_FACTOR;
 
        status = cf_util_get_string (ci, &host->name);