summaryrefslogtreecommitdiffstats
path: root/claim
diff options
context:
space:
mode:
authorTimotej S <6674623+underhood@users.noreply.github.com>2020-11-26 17:26:01 +0100
committerGitHub <noreply@github.com>2020-11-26 17:26:01 +0100
commitf1db235a36d85f81c5a19a7087567405771874f7 (patch)
treef99084d252e0af0496bf4776fa2c118f15dbee1a /claim
parent4f867a58e5287e54aa5ecae023868615cafb9f93 (diff)
ACLK Child Availability Messages (#9918)
* new ACLK messages for Claiming MVP1
Diffstat (limited to 'claim')
-rw-r--r--claim/claim.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/claim/claim.c b/claim/claim.c
index 7846925e6d..d87f46a7f8 100644
--- a/claim/claim.c
+++ b/claim/claim.c
@@ -34,9 +34,9 @@ static char *claiming_errors[] = {
char *is_agent_claimed()
{
char *result;
- netdata_mutex_lock(&localhost->claimed_id_lock);
- result = (localhost->claimed_id == NULL) ? NULL : strdupz(localhost->claimed_id);
- netdata_mutex_unlock(&localhost->claimed_id_lock);
+ rrdhost_aclk_state_lock(localhost);
+ result = (localhost->aclk_state.claimed_id == NULL) ? NULL : strdupz(localhost->aclk_state.claimed_id);
+ rrdhost_aclk_state_unlock(localhost);
return result;
}
@@ -134,10 +134,10 @@ void load_claiming_state(void)
netdata_cloud_setting = 0;
#else
uuid_t uuid;
- netdata_mutex_lock(&localhost->claimed_id_lock);
- if (localhost->claimed_id) {
- freez(localhost->claimed_id);
- localhost->claimed_id = NULL;
+ rrdhost_aclk_state_lock(localhost);
+ if (localhost->aclk_state.claimed_id) {
+ freez(localhost->aclk_state.claimed_id);
+ localhost->aclk_state.claimed_id = NULL;
}
if (aclk_connected)
{
@@ -159,8 +159,8 @@ void load_claiming_state(void)
freez(claimed_id);
claimed_id = NULL;
}
- localhost->claimed_id = claimed_id;
- netdata_mutex_unlock(&localhost->claimed_id_lock);
+ localhost->aclk_state.claimed_id = claimed_id;
+ rrdhost_aclk_state_unlock(localhost);
if (!claimed_id) {
info("Unable to load '%s', setting state to AGENT_UNCLAIMED", filename);
return;