summaryrefslogtreecommitdiffstats
path: root/src/plugins/influxdb.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-04-08 23:57:15 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:41:13 +0200
commit9ef2eba5e4344c1370754004a997970ca11e16ca (patch)
tree1ac65ad55faa8f2c5eddb06a582ffaf4729706e6 /src/plugins/influxdb.c
parent631ca5d45726f7755fc39b60e0525e09230fbd95 (diff)
Introduce thread management for future reading job
Change-Id: I1d47aef85c4a90d10d7cd5f85c357e9e35664836 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/plugins/influxdb.c')
-rw-r--r--src/plugins/influxdb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/influxdb.c b/src/plugins/influxdb.c
index 74c1297..17c140d 100644
--- a/src/plugins/influxdb.c
+++ b/src/plugins/influxdb.c
@@ -15,7 +15,12 @@
* limitations under the License.
*/
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdio.h>
+
#include "tsdb.h"
+#include "wrap-json.h"
int create_database()
{
@@ -37,7 +42,6 @@ int create_database()
}
curl_easy_cleanup(request);
- free(post_data);
if(ret == 0)
AFB_NOTICE("Database 'agl-collector' created");
@@ -148,7 +152,7 @@ CURL *make_curl_write_post(const char *url, struct json_object *metric)
curl = NULL;
}
else {
- for(int i = lpd; i != 0; i--) {
+ for(long unsigned int i = lpd; i != 0; i--) {
format_write_query(query, name, source, unit, identity, jv, timestamp);
post_data[i] = i == lpd ? NULL : query;
}
@@ -169,5 +173,5 @@ CURL *influxdb_write(const char* host, int port, json_object *metric)
strncat(url, host, strlen(host));
strncat(url, ":"DEFAULT_DBPORT"/write?db="DEFAULT_DB, strlen(":"DEFAULT_DBPORT"/write?db="DEFAULT_DB));
- curl_request = make_curl_write_post(url, metric);
+ return make_curl_write_post(url, metric);
}