Skip to content

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

Merged
merged 1 commit into from
Sep 16, 2016

Conversation

geky
Copy link
Contributor

@geky geky commented Aug 26, 2016

  • Check if disconnected in socket open
  • Check if connected in interface connect
  • Check if disconnected in interface disconnect

Related issues #2439, #2421, #2445

- Check if disconnected in socket open
- Check if connected in interface connect
- Check if disconnected in interface disconnect
@sg-
Copy link
Contributor

sg- commented Sep 8, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@sg-
Copy link
Contributor

sg- commented Sep 8, 2016

/morph test

@sg- sg- removed the needs: review label Sep 8, 2016
@mbed-bot
Copy link

mbed-bot commented Sep 9, 2016

[Build ${MBED_BUILD_ID}]
FAILURE: Something went wrong when building and testing.

@mbed-bot
Copy link

mbed-bot commented Sep 9, 2016

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 789

All builds and test passed!

{
// Check if we've connected
if (!lwip_get_ip_address()) {
return NSAPI_ERROR_PARAMETER;
Copy link
Contributor

@bogdanm bogdanm Sep 9, 2016

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)?

Copy link
Contributor Author

@geky geky Sep 9, 2016

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?

@sg- sg- merged commit 1a91c1c into ARMmbed:master Sep 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants