Add delay on missing priv_key (#12450)
Timotej S committed
Mar 18, 2022 at 10:34 UTC
e2e991eb5bbb71f3028e181b720ee2a193d1e51b
1 file changed
+7
-7
aclk/aclk.c
+7
-7
@@ -123,7 +123,7 @@ static int wait_till_agent_claimed(void)
123
* @param aclk_hostname points to location where string pointer to hostname will be set
124
* @param aclk_port port to int where port will be saved
125
*
126
- * @return If non 0 returned irrecoverable error happened and ACLK should be terminated
126
+ * @return If non 0 returned irrecoverable error happened (or netdata_exit) and ACLK should be terminated
127
*/
128
static int wait_till_agent_claim_ready()
129
{
@@ -144,20 +144,20 @@ static int wait_till_agent_claim_ready()
144
// TODO make it without malloc/free
145
memset(&url, 0, sizeof(url_t));
146
if (url_parse(cloud_base_url, &url)) {
147
- error("Agent is claimed but the configuration is invalid, please fix");
147
+ error("Agent is claimed but the URL in configuration key \"cloud base url\" is invalid, please fix");
148
url_t_destroy(&url);
149
sleep(5);
150
continue;
151
}
152
url_t_destroy(&url);
153
154
- if (!load_private_key()) {
155
- sleep(5);
156
- break;
157
- }
154
+ if (!load_private_key())
155
+ return 0;
156
+
157
+ sleep(5);
158
}
159
160
- return 0;
160
+ return 1;
161
}
162
163
void aclk_mqtt_wss_log_cb(mqtt_wss_log_type_t log_type, const char* str)