Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static client Process function problem when ethernet link goes down #311

Open
luizeduardogiampaoli opened this issue Dec 17, 2016 · 2 comments

Comments

@luizeduardogiampaoli
Copy link

Hello!

First of all, thank you for the great framework! I´ve been using AwaLWM2M as configuration and side monitoring channel on my own custom IoT solution. I use AwaLWM2M compiled as static client in more than one kind of arm based device. AwaLWM2M objects are dedicated to configuration and runtinme information channel (for IoT data I have my own framwrok objects and other channels completely independent). For what I need, it is working very well, but unfortunetly I detected a behavior that is causing a problem:

My framework is also based on a continuous loop with various steps, one of these steps is obviously to call: lwm2m_client_->Process(), which is no more than a wrapper to: AwaStaticClient_Process(...);

The solution works rock steady 24/7 (even with the Awa server down, no problem, I know that is by design it only logs registration unsucessfull. Once the server is up again, it connects with no problem).

BUT, if we disconnect the ethernet cable from the device and the ethernet link really goes down, the static client is not able to recover and the AwaStaticClient_Process(...) function blocks, blocking all the loop and the device becomes unresponsive.

As a workaround, I am thinking to put the Process() call inside some kind of worker thread to generate a timeout. Are you aware of the bahavior I described?

The other possibility is to try to look at the Awa source code and see if I can help. May you point the directions to where the problem may be? I am willing to help.

Regards,
Luiz Eduardo Giampaoli

@DavidAntliff
Copy link
Collaborator

Hi Luiz,

I'm not previously aware of this behaviour, however this is definitely an area that could benefit from some improvement. Please do look at the source code - you'll probably want to start here:

https://github.com/FlowM2M/AwaLWM2M/blob/master/core/src/client/lwm2m_static.c#L371

You may need to set an option on the socket to avoid the block. Or, if you need to write your own "Process" function, using this as a guide, that's perfectly acceptable.

@luizeduardogiampaoli
Copy link
Author

I will take a look into it. Thank you for your reply!

Regards,
Luiz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants