Commit f914258e authored by Kishen Maloor's avatar Kishen Maloor

Fix observer removal logic on RFNOP transitions

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent d775843a
......@@ -150,7 +150,7 @@ oc_pstat_handle_state(oc_sec_pstat_t *ps, size_t device, bool from_storage,
oc_sec_doxm_default(device);
oc_sec_cred_default(device);
oc_sec_acl_default(device);
if (!from_storage) {
if (!from_storage && oc_get_con_res_announced()) {
oc_device_info_t *di = oc_core_get_device_info(device);
oc_free_string(&di->name);
}
......@@ -258,9 +258,6 @@ oc_pstat_handle_state(oc_sec_pstat_t *ps, size_t device, bool from_storage,
ps->p = false;
} break;
case OC_DOS_RFNOP: {
#ifdef OC_SERVER
coap_remove_observers_on_dos_change(device, false);
#endif /* OC_SERVER */
ps->p = true;
ps->cm = 0;
ps->tm = 0;
......@@ -373,6 +370,11 @@ oc_pstat_handle_state(oc_sec_pstat_t *ps, size_t device, bool from_storage,
break;
}
memmove(&pstat[device], ps, sizeof(oc_sec_pstat_t));
#ifdef OC_SERVER
if (ps->s == OC_DOS_RFNOP) {
coap_remove_observers_on_dos_change(device, false);
}
#endif /* OC_SERVER */
OC_DBG("oc_pstat: leaving pstat_handle_state");
return true;
pstat_state_error:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment