diff options
Diffstat (limited to '')
-rw-r--r-- | src/aclk/aclk.c (renamed from aclk/aclk.c) | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/aclk/aclk.c b/src/aclk/aclk.c index e95d7d6ab..991745491 100644 --- a/aclk/aclk.c +++ b/src/aclk/aclk.c @@ -4,7 +4,7 @@ #ifdef ENABLE_ACLK #include "aclk_stats.h" -#include "mqtt_wss_client.h" +#include "mqtt_websockets/mqtt_wss_client.h" #include "aclk_otp.h" #include "aclk_tx_msgs.h" #include "aclk_query.h" @@ -817,10 +817,6 @@ void *aclk_main(void *ptr) unsigned int proto_hdl_cnt = aclk_init_rx_msg_handlers(); - // This thread is unusual in that it cannot be cancelled by cancel_main_threads() - // as it must notify the far end that it shutdown gracefully and avoid the LWT. - netdata_thread_disable_cancelability(); - #if defined( DISABLE_CLOUD ) || !defined( ENABLE_ACLK ) nd_log(NDLS_DAEMON, NDLP_INFO, "Killing ACLK thread -> cloud functionality has been disabled"); @@ -861,13 +857,10 @@ void *aclk_main(void *ptr) aclk_stats_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "statistics", global_statistics_enabled); if (aclk_stats_enabled) { stats_thread = callocz(1, sizeof(struct aclk_stats_thread)); - stats_thread->thread = mallocz(sizeof(netdata_thread_t)); stats_thread->query_thread_count = query_threads.count; stats_thread->client = mqttwss_client; aclk_stats_thread_prepare(query_threads.count, proto_hdl_cnt); - netdata_thread_create( - stats_thread->thread, "ACLK_STATS", NETDATA_THREAD_OPTION_JOINABLE, aclk_stats_main_thread, - stats_thread); + stats_thread->thread = nd_thread_create("ACLK_STATS", NETDATA_THREAD_OPTION_JOINABLE, aclk_stats_main_thread, stats_thread); } // Keep reconnecting and talking until our time has come @@ -901,9 +894,8 @@ exit_full: aclk_query_threads_cleanup(&query_threads); if (aclk_stats_enabled) { - netdata_thread_join(*stats_thread->thread, NULL); + nd_thread_join(stats_thread->thread); aclk_stats_thread_cleanup(); - freez(stats_thread->thread); freez(stats_thread); } free_topic_cache(); @@ -919,7 +911,7 @@ exit: void aclk_host_state_update(RRDHOST *host, int cmd, int queryable) { - uuid_t node_id; + nd_uuid_t node_id; int ret = 0; if (!aclk_connected) @@ -1165,7 +1157,7 @@ char *aclk_state(void) buffer_strcat(wb, "\n\tAlert Streaming Status:"); fill_alert_status_for_host(wb, host); } - rrd_unlock(); + rrd_rdunlock(); } ret = strdupz(buffer_tostring(wb)); @@ -1315,7 +1307,7 @@ char *aclk_state_json(void) json_object_array_add(grp, nodeinstance); } - rrd_unlock(); + rrd_rdunlock(); json_object_object_add(msg, "node-instances", grp); char *str = strdupz(json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN)); |