-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix status sequence and reporting for LWIP stack #8381
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
@michalpasztamobica Could you be a bit more clear/explicit/verbose on the description of the PR? Which status? Which documentation? |
Documentation: ARMmbed/mbed-os-5-docs#744 This PR fixes the EthernetInterface events to match the submitted documentation. |
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.
Verify the scenario I described and also check if that extra whitespace is correct.
Other that those, this looks OK.
features/lwipstack/LWIPInterface.cpp
Outdated
if (interface->has_addr_state & HAS_ANY_ADDR) { | ||
interface->connected = NSAPI_STATUS_GLOBAL_UP; | ||
} | ||
} else { | ||
} else if (!netif_is_up(&interface->netif) && netif_is_link_up(&interface->netif)) { | ||
// disconnect() was called, because netif_is_link_up is returning true even though netif is down. |
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.
After discussing about this, I'm still wondering that there should be one more test.
What happens if you disconnect the ethernet cable, and then call interface->disconnect()
I would assume that in that case both functions are returning false
in which case the generated event is probably not correct.
@michalpasztamobica Can you verify?
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.
Excellent point, you are right - if I call interface->disconnect()
after I unplugged the cable there is no status change (it should change to DISCONNECTED
).
I will try to improve the condition, but I am afraid we need to entangle the connection status and create kind of a simple state machine, which considers previous state in its logic.
59a7249
to
340e7d5
Compare
Thank you for the remarks. I had to modify the logic quite a bit to get the events working as per documentation, but now I tested all possible scenarios:
|
340e7d5
to
bc2a1c1
Compare
@0xc0170 Please start the tests. |
/morph build |
@kjbracey-arm In case you still wanted to review this. |
Build : SUCCESSBuild number : 3386 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3018 |
@cmonr You can remove the "needs: review" label. |
Description
Connection status in LWIP Interfeace is being reported according to documentation, which can be found here: https://github.com/ARMmbed/mbed-os-5-docs/blob/a96abc0a89af7c0e02d0535c940aa68a989ff1e9/docs/api/networkinterfaces/networkinterface.md
Pull request type