Skip to content

Commit

Permalink
Clear observation list on registration (#6)
Browse files Browse the repository at this point in the history
LwM2M standard states that the server MUST reinitiate observations, but as a quick fix, just remove them.
  • Loading branch information
GiedriusM committed Jan 24, 2018
1 parent eed3d8b commit 72af9fa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/registration.c
Expand Up @@ -1128,6 +1128,15 @@ uint8_t registration_handleRequest(lwm2m_context_t * contextP,
if (clientP->altPath != NULL) lwm2m_free(clientP->altPath);
prv_freeClientObjectList(clientP->objectList);
clientP->objectList = NULL;

// observations should be reinitiated instead of removed
lwm2m_observation_t *observationP = clientP->observationList;
while (observationP != NULL)
{
lwm2m_observation_t *nextP = observationP->next;
observe_remove(observationP);
observationP = nextP;
}
}
else
{
Expand Down

0 comments on commit 72af9fa

Please sign in to comment.