diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2020-04-16 10:07:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 10:07:12 +0300 |
commit | 84101a234a6c3e138c6be3a9dc4c03a89e689333 (patch) | |
tree | 65b7e06a25662248785dae43bdadbab0ae3f9fdd /aclk | |
parent | 467d6b71a85d0c60363ef0d1f6b4701d2fd370eb (diff) |
Improved ACLK reconnection sequence (#8729)
Improved ACLK reconnection sequence
Diffstat (limited to 'aclk')
-rw-r--r-- | aclk/agent_cloud_link.c | 4 |
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) { |