ARMmbed / mbed-client-for-aws

AWS IoT SDK port for Mbed OS
Apache License 2.0
8 stars 13 forks source link

Network receive should be blocking #6

Closed boraozgen closed 4 years ago

boraozgen commented 4 years ago

Hi all,

I've been trying out the port and kept receiving NSAPI_ERROR_WOULD_BLOCK (-3001) error. Turns out that IotNetworkInterface_t.receive is supposed to be blocking, whereas the call is set to non-blocking in the port, as seen here:

https://github.com/ARMmbed/mbed-aws-client/blob/455937ace2ddeb5078ea0c71ba51bf1b6fa67b6a/mbed/src/iot_network.cpp#L201-L203

The issue is fixed when the socket is set to blocking before the call.

LDong-Arm commented 4 years ago

Turns out that IotNetworkInterface_t.receive is supposed to be blocking, whereas the call is set to non-blocking in the port, as seen here:

https://github.com/ARMmbed/mbed-aws-client/blob/455937ace2ddeb5078ea0c71ba51bf1b6fa67b6a/mbed/src/iot_network.cpp#L201-L203

The issue is fixed when the socket is set to blocking before the call.

Yes, it should be blocking according to the requirement by the AWS SDK. I think it should be the other way round -true before recv and false after? @ithinuel @ashok-rao

@boraozgen Good catch. Please feel free to make a PR for the issues you spotted, it would be highly appreciated.

boraozgen commented 4 years ago

Since my network port has diverged quite a lot from this repo, I unfortunately cannot open a PR for this issue. This should be easy to fix though.

ciarmcom commented 4 years ago

@boraozgen thank you for raising this issue.Please take a look at the following comments:

Could you add some more detail to the description? A good description should be at least 25 words. What target(s) are you using? What toolchain(s) are you using? What version of Mbed OS are you using (tag or sha)? It would help if you could also specify the versions of any tools you are using? How can we reproduce your issue?

NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'.This indicates to us that at least all the fields have been considered. Please update the issue header with the missing information, the issue will not be mirroredto our internal defect tracking system or investigated until this has been fully resolved.

ciarmcom commented 4 years ago

@boraozgen it has been 5 days since the last reminder. Could you please update the issue header as previously requested?