summaryrefslogtreecommitdiffstats
path: root/exporting
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-06-23 12:31:40 +0300
committerGitHub <noreply@github.com>2020-06-23 12:31:40 +0300
commit42f5e0122080c51f8dc7f1ba938e444e3efd5502 (patch)
tree0ce0afd13e56acf2c471b389b2692fda0b568f6a /exporting
parent47537f03a5419946fbe8c67289cb9ac85090a3fa (diff)
Fix a bug in the simple exporting connector (#9389)
Diffstat (limited to 'exporting')
-rw-r--r--exporting/read_config.c2
-rw-r--r--exporting/send_data.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/exporting/read_config.c b/exporting/read_config.c
index d7004a43d7..d9fea656ec 100644
--- a/exporting/read_config.c
+++ b/exporting/read_config.c
@@ -192,7 +192,7 @@ struct engine *read_exporting_config()
struct connector_instance_list *next;
};
struct connector_instance local_ci;
- struct connector_instance_list *tmp_ci_list, *tmp_ci_list1, *tmp_ci_list_prev = NULL;
+ struct connector_instance_list *tmp_ci_list = NULL, *tmp_ci_list1 = NULL, *tmp_ci_list_prev = NULL;
if (unlikely(engine))
return engine;
diff --git a/exporting/send_data.c b/exporting/send_data.c
index f5fbc03401..e7fda72331 100644
--- a/exporting/send_data.c
+++ b/exporting/send_data.c
@@ -61,7 +61,8 @@ void simple_connector_receive_response(int *sock, struct instance *instance)
ssize_t r;
#ifdef ENABLE_HTTPS
- if (options & EXPORTING_OPTION_USE_TLS &&
+ if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP &&
+ options & EXPORTING_OPTION_USE_TLS &&
connector_specific_data->conn &&
connector_specific_data->flags == NETDATA_SSL_HANDSHAKE_COMPLETE) {
r = (ssize_t)SSL_read(connector_specific_data->conn,
@@ -159,7 +160,8 @@ void simple_connector_send_buffer(int *sock, int *failures, struct instance *ins
if (!ret) {
#ifdef ENABLE_HTTPS
- if (options & EXPORTING_OPTION_USE_TLS &&
+ if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP &&
+ options & EXPORTING_OPTION_USE_TLS &&
connector_specific_data->conn &&
connector_specific_data->flags == NETDATA_SSL_HANDSHAKE_COMPLETE) {
written = (ssize_t)SSL_write(connector_specific_data->conn, buffer_tostring(buffer), len);
@@ -280,7 +282,7 @@ void simple_connector_worker(void *instance_p)
NULL,
0);
#ifdef ENABLE_HTTPS
- if(sock != -1) {
+ if(instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && sock != -1) {
if (netdata_opentsdb_ctx) {
if ( sock_delnonblock(sock) < 0 )
error("Exporting cannot remove the non-blocking flag from socket %d", sock);
@@ -387,7 +389,7 @@ void simple_connector_worker(void *instance_p)
#endif
#ifdef ENABLE_HTTPS
- if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && options & EXPORTING_OPTION_USE_TLS) {
+ if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && options & EXPORTING_OPTION_USE_TLS) {
SSL_free(connector_specific_data->conn);
freez(instance->connector_specific_data);
}