-
Notifications
You must be signed in to change notification settings - Fork 3k
lwip - Add checks for invalid state of network #2561
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
Conversation
57d1548
to
c483770
Compare
- Check if disconnected in socket open - Check if connected in interface connect - Check if disconnected in interface disconnect
c483770
to
98ec80c
Compare
@mbed-bot: TEST HOST_OSES=ALL |
/morph test |
[Build ${MBED_BUILD_ID}] |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 789 All builds and test passed! |
{ | ||
// Check if we've connected | ||
if (!lwip_get_ip_address()) { | ||
return NSAPI_ERROR_PARAMETER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this supposed to be return NSAPI_ERROR_NO_CONNECTION
(like below)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, there's not much precedent here that I am aware of.
I chose NSAPI_ERROR_PARAMETER to match the error on connecting an already connected network interface (L148). Disconnecting an already disconnected interface is more a user error than a network error. Do you think this should be NSAPI_ERROR_NO_CONNECTION?
Related issues #2439, #2421, #2445