Fix notification race condition

This commit is contained in:
Suvendhu Hansa 2024-11-20 12:54:48 +05:30
parent 193480d9b3
commit b3ecc45d99
2 changed files with 13 additions and 4 deletions

View file

@ -756,6 +756,11 @@ int check_value_change(void)
blob_buf_free(&bbuf);
}
fclose(fp);
if (notif_ret > 0) {
apply_notify_values(&list_notify_params);
}
cwmp_free_all_dm_parameter_list(&list_notify_params);
return notif_ret;
}
@ -824,8 +829,6 @@ void periodic_check_notifiy(struct uloop_timeout *timeout __attribute__((unused
cr_url_retry = 3;
is_notify = check_value_change();
if (is_notify > 0)
cwmp_update_enabled_notify_file();
if (is_notify & NOTIF_ACTIVE) {
send_active_value_change();
int last_session_interval = time(NULL) - cwmp_ctx.session->session_status.last_end_time;

View file

@ -377,15 +377,21 @@ void start_cwmp_session(void)
* Value changes
*/
if (!cwmp_ctx.session->session_status.is_heartbeat) {
int is_notify = 0;
if (file_exists(DM_ENABLED_NOTIFY)) {
int is_notify = 0;
if (!event_exist_in_list(EVENT_IDX_4VALUE_CHANGE))
is_notify = check_value_change();
if (is_notify > 0)
cwmp_ctx.custom_notify_active = false;
}
if (is_notify > 0 || !file_exists(DM_ENABLED_NOTIFY) || cwmp_ctx.custom_notify_active) {
if (!file_exists(DM_ENABLED_NOTIFY) || cwmp_ctx.custom_notify_active) {
cwmp_ctx.custom_notify_active = false;
cwmp_update_enabled_notify_file();
}
cwmp_prepare_value_change();
clean_list_value_change();
}