@cryptotaxi247 / netdata-1 / commits / 42f5e0122

Fix a bug in the simple exporting connector (#9389)

Vladimir Kobal committed Jun 23, 2020 at 12:31 UTC 42f5e0122080c51f8dc7f1ba938e444e3efd5502
2 files changed +7 -5
exporting/read_config.c
+1 -1
@@ -192,7 +192,7 @@ struct engine *read_exporting_config()
192 struct connector_instance_list *next;
193 };
194 struct connector_instance local_ci;
195 - struct connector_instance_list *tmp_ci_list, *tmp_ci_list1, *tmp_ci_list_prev = NULL;
195 + struct connector_instance_list *tmp_ci_list = NULL, *tmp_ci_list1 = NULL, *tmp_ci_list_prev = NULL;
196
197 if (unlikely(engine))
198 return engine;
exporting/send_data.c
+6 -4
@@ -61,7 +61,8 @@ void simple_connector_receive_response(int *sock, struct instance *instance)
61
62 ssize_t r;
63 #ifdef ENABLE_HTTPS
64 - if (options & EXPORTING_OPTION_USE_TLS &&
64 + if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP &&
65 + options & EXPORTING_OPTION_USE_TLS &&
66 connector_specific_data->conn &&
67 connector_specific_data->flags == NETDATA_SSL_HANDSHAKE_COMPLETE) {
68 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
160
161 if (!ret) {
162 #ifdef ENABLE_HTTPS
162 - if (options & EXPORTING_OPTION_USE_TLS &&
163 + if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP &&
164 + options & EXPORTING_OPTION_USE_TLS &&
165 connector_specific_data->conn &&
166 connector_specific_data->flags == NETDATA_SSL_HANDSHAKE_COMPLETE) {
167 written = (ssize_t)SSL_write(connector_specific_data->conn, buffer_tostring(buffer), len);
@@ -280,7 +282,7 @@ void simple_connector_worker(void *instance_p)
282 NULL,
283 0);
284 #ifdef ENABLE_HTTPS
283 - if(sock != -1) {
285 + if(instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && sock != -1) {
286 if (netdata_opentsdb_ctx) {
287 if ( sock_delnonblock(sock) < 0 )
288 error("Exporting cannot remove the non-blocking flag from socket %d", sock);
@@ -387,7 +389,7 @@ void simple_connector_worker(void *instance_p)
389 #endif
390
391 #ifdef ENABLE_HTTPS
390 - if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && options & EXPORTING_OPTION_USE_TLS) {
392 + if (instance->config.type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP && options & EXPORTING_OPTION_USE_TLS) {
393 SSL_free(connector_specific_data->conn);
394 freez(instance->connector_specific_data);
395 }