summaryrefslogtreecommitdiffstats
path: root/aclk
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2020-04-15 21:37:16 +0300
committerGitHub <noreply@github.com>2020-04-15 21:37:16 +0300
commit853b23745e7df2f163df1c0213c9de52394de36b (patch)
tree2a2f592ff2ba95c5b5ba294dc93801db009efba1 /aclk
parent81b6d6e600333e6731fb4b92e86a8292c79d5a48 (diff)
Improved ACLK reconnection sequence (#8708)
* Change aclk_connecting to a counter and attempt to reconnect in case the LWS layer is not responding (no callbacks received) Do not attempt subscription if we are not connected * Set aclk_connecting before calling the MQTT / LWS layer
Diffstat (limited to 'aclk')
-rw-r--r--aclk/agent_cloud_link.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/aclk/agent_cloud_link.c b/aclk/agent_cloud_link.c
index a41d17e7bd..1c276f9919 100644
--- a/aclk/agent_cloud_link.c
+++ b/aclk/agent_cloud_link.c
@@ -1257,11 +1257,11 @@ static void aclk_try_to_connect(char *hostname, char *port, int port_num)
if (aclk_password == NULL)
return;
int rc;
+ aclk_connecting = 1;
rc = mqtt_attempt_connection(hostname, port_num, aclk_username, aclk_password);
if (unlikely(rc)) {
error("Failed to initialize the agent cloud link library");
}
- aclk_connecting = 1;
}
@@ -1355,6 +1355,8 @@ void *aclk_main(void *ptr)
}
_link_event_loop();
+ if (unlikely(!aclk_connected))
+ continue;
/*static int stress_counter = 0;
if (write_q_bytes==0 && stress_counter ++ >5)
{