projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3182 from ccin2p3/f/config-return-codes
[collectd.git]
/
src
/
write_tsdb.c
diff --git
a/src/write_tsdb.c
b/src/write_tsdb.c
index
777f4cc
..
f8f4cb9
100644
(file)
--- a/
src/write_tsdb.c
+++ b/
src/write_tsdb.c
@@
-43,8
+43,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include "utils_cache.h"
#include "utils_random.h"
#include "utils_cache.h"
#include "utils_random.h"
@@
-79,8
+79,8
@@
struct wt_callback {
char *service;
char *host_tags;
char *service;
char *host_tags;
-
_B
ool store_rates;
-
_B
ool always_append_ds;
+
b
ool store_rates;
+
b
ool always_append_ds;
char send_buf[WT_SEND_BUF_SIZE];
size_t send_buf_free;
char send_buf[WT_SEND_BUF_SIZE];
size_t send_buf_free;
@@
-89,13
+89,13
@@
struct wt_callback {
pthread_mutex_t send_lock;
pthread_mutex_t send_lock;
-
_B
ool connect_failed_log_enabled;
+
b
ool connect_failed_log_enabled;
int connect_dns_failed_attempts_remaining;
cdtime_t next_random_ttl;
};
int connect_dns_failed_attempts_remaining;
cdtime_t next_random_ttl;
};
-static cdtime_t resolve_interval
= 0
;
-static cdtime_t resolve_jitter
= 0
;
+static cdtime_t resolve_interval;
+static cdtime_t resolve_jitter;
/*
* Functions
/*
* Functions
@@
-112,9
+112,8
@@
static int wt_send_buffer(struct wt_callback *cb) {
status = swrite(cb->sock_fd, cb->send_buf, strlen(cb->send_buf));
if (status != 0) {
status = swrite(cb->sock_fd, cb->send_buf, strlen(cb->send_buf));
if (status != 0) {
- char errbuf[1024];
ERROR("write_tsdb plugin: send failed with status %zi (%s)", status,
ERROR("write_tsdb plugin: send failed with status %zi (%s)", status,
-
sstrerror(errno, errbuf, sizeof(errbuf))
);
+
STRERRNO
);
close(cb->sock_fd);
cb->sock_fd = -1;
close(cb->sock_fd);
cb->sock_fd = -1;
@@
-153,7
+152,7
@@
static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb) {
return status;
}
return status;
}
-static cdtime_t new_random_ttl() {
+static cdtime_t new_random_ttl(
void
) {
if (resolve_jitter == 0)
return 0;
if (resolve_jitter == 0)
return 0;
@@
-242,10
+241,9
@@
static int wt_callback_init(struct wt_callback *cb) {
}
if (cb->sock_fd < 0) {
}
if (cb->sock_fd < 0) {
- char errbuf[1024];
ERROR("write_tsdb plugin: Connecting to %s:%s failed. "
"The last error was: %s",
ERROR("write_tsdb plugin: Connecting to %s:%s failed. "
"The last error was: %s",
- node, service,
sstrerror(errno, errbuf, sizeof(errbuf))
);
+ node, service,
STRERRNO
);
return -1;
}
return -1;
}
@@
-279,6
+277,7
@@
static void wt_callback_free(void *data) {
sfree(cb->service);
sfree(cb->host_tags);
sfree(cb->service);
sfree(cb->host_tags);
+ pthread_mutex_unlock(&cb->send_lock);
pthread_mutex_destroy(&cb->send_lock);
sfree(cb);
pthread_mutex_destroy(&cb->send_lock);
sfree(cb);
@@
-314,7
+313,7
@@
static int wt_flush(cdtime_t timeout,
static int wt_format_values(char *ret, size_t ret_len, int ds_num,
const data_set_t *ds, const value_list_t *vl,
static int wt_format_values(char *ret, size_t ret_len, int ds_num,
const data_set_t *ds, const value_list_t *vl,
-
_B
ool store_rates) {
+
b
ool store_rates) {
size_t offset = 0;
int status;
gauge_t *rates = NULL;
size_t offset = 0;
int status;
gauge_t *rates = NULL;