Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Easymesh agent to retry indefinitely on init_dml failure #128

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions src/agent/em_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "em_orch_agent.h"
#include "util.h"

#define MAX_RETRY 20
#define RETRY_SLEEP_INTERVAL_IN_MS 1000

em_agent_t g_agent;
Expand Down Expand Up @@ -422,23 +421,11 @@ void em_agent_t::input_listener()

memset(&data, 0, sizeof(raw_data_t));

while (((bus_error_val = desc->bus_data_get_fn(&m_bus_hdl, WIFI_WEBCONFIG_INIT_DML_DATA, &data)) != bus_error_success)
&& num_retry < MAX_RETRY) {
while ((bus_error_val = desc->bus_data_get_fn(&m_bus_hdl, WIFI_WEBCONFIG_INIT_DML_DATA, &data)) != bus_error_success) {
printf("%s:%d bus get failed, error:%d, ", __func__, __LINE__, bus_error_val);
if (bus_error_val == bus_error_access_not_allowed) {
// This error can come when backhaul STA is not yet connected, thus retry after some amount of sleep
usleep(RETRY_SLEEP_INTERVAL_IN_MS * 1000);
num_retry++;
printf("retry %d of %d\n", num_retry, MAX_RETRY);
} else {
printf("no retries, returning..\n");
return;
}
}

if (num_retry == MAX_RETRY) {
printf("no further retries, returning..\n");
return;
printf("retrying %d\n", num_retry);
}
printf("%s:%d recv data:\r\n%s\r\n", __func__, __LINE__, (char *)data.raw_data.bytes);

Expand Down
Loading