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

[photon/p1] wlan: make sure to close all sockets when deinitializing WICED connectivity subsystem #2313

Merged

Conversation

avtolstoy
Copy link
Member

Problem

Entering listening mode on Photon and P1 does not invalidate current sockets, while at the same time wlan_restart() will call into WICED to deinitialize LwIP stack, which invalidates netconns that are in use by WICED sockets and our socket layer.

Performing socket actions on a handle that has a reference to invalidated WICED socket/LwIP netconn may cause a crash.

Solution

Make sure to call socket_close_all() in wlan_restart() to avoid getting into this state.

Steps to Test

  • wiring/no_fixture: WIFI_15_entering_listening_mode_and_enabling_softap_closes_active_sockets_cleanly

Example App

N/A

References

  • [CH78867]

Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

@avtolstoy avtolstoy added this to the 2.2.0 milestone May 11, 2021
@avtolstoy avtolstoy requested a review from XuGuohui May 11, 2021 20:37
@avtolstoy avtolstoy force-pushed the fix/ch78867/photon-p1-socket-invalidate-on-wlan-restart branch from 7331f1c to 12d0b28 Compare May 18, 2021 04:30
@avtolstoy avtolstoy merged commit 1fc4b27 into develop May 18, 2021
@avtolstoy avtolstoy deleted the fix/ch78867/photon-p1-socket-invalidate-on-wlan-restart branch May 18, 2021 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants