intel / liblwm2m

liblwm2m is an implementation of the LWM2M protocol from the Open Mobile Alliance.
BSD 3-Clause "New" or "Revised" License
44 stars 28 forks source link

Client deregistration issue #37

Closed paulkeogh closed 8 years ago

paulkeogh commented 10 years ago

Hi,

I think there may be an issue with client dereg. Consider the use case where a client registers and immediately deregisters (for whatever reason). There is a possibility that the client will not have handled the registration response from the server and hence not updated the status of the lwm2m_server_t instance to STATE_REGISTERED.

Consequently the deregistration by client will fail because in registration.c/registration_deregister() there is a line;

if (serverP->status != STATE_REGISTERED) return;

Which causes the function to return without sending the dereg command. The server is then left holding a reference to a client.

Is this a valid use case ?

dnav commented 10 years ago

Yes it is. Thanks for spotting this. I will fix this.

Regarding the server holding a reference to a client, this can also happens if the connection is lost or if the client exits without deregistering. Note this is handled in the protocol by the lifetime mechanism: the registration is valid for a duration specified in the Server object's lifetime resource. If it is not updated by the client, the server drops the registration. This is not implemented yet in liblwm2m.

dnav commented 8 years ago

Project moved to http://github.com/eclipse/wakaama