Fix uloop deadlock for ProcessStatus

This commit is contained in:
suvendhu 2022-10-13 11:33:10 +05:30 committed by Vivek Kumar Dutta
parent a46c3c57a4
commit 7a21881293
3 changed files with 29 additions and 5 deletions

View file

@ -68,15 +68,21 @@ static int get_linker_process(char* refparam, struct dmctx *ctx, void *data, cha
**************************************************************/
static bool is_update_process_allowed(void)
{
json_object *res = NULL;
char *tr069_status = NULL;
dmubus_call("tr069", "status", UBUS_ARGS{0}, 0, &res);
if (!res)
if (dmubus_object_exist("tr069")) {
struct uci_section *s = NULL, *stmp = NULL;
uci_path_foreach_sections_safe(varstate, "cwmp", "sess_status", stmp, s) {
dmuci_get_value_by_section_string(s, "current_status", &tr069_status);
}
}
if (tr069_status == NULL)
goto end;
char *tr069_status = dmjson_get_value(res, 2, "last_session", "status");
if (strcmp(tr069_status, "running") == 0)
if (strcmp(tr069_status, "running") == 0) {
return false;
}
end:
return true;

View file

@ -705,3 +705,20 @@ void dmubus_set_caching_time(int seconds)
soft_limit_g = seconds/2;
hard_limit_g = seconds;
}
bool dmubus_object_exist(char *object)
{
uint32_t id;
if (ubus_ctx == NULL) {
ubus_ctx = dm_libubus_init();
if (ubus_ctx == NULL) {
return false;
}
}
if (!ubus_lookup_id(ubus_ctx, object, &id))
return true;
return false;
}

View file

@ -31,5 +31,6 @@ void dmubus_clean_endlife_entries();
void dmubus_set_caching_time(int seconds);
void dmubus_register_event_blocking(char *event, int timeout, struct blob_attr *type);
int dmubus_call_blocking(char *obj, char *method, struct ubus_arg u_args[], int u_args_size, json_object **req_res);
bool dmubus_object_exist(char *object);
#endif