-
Notifications
You must be signed in to change notification settings - Fork 93
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
Address several ESP32 network driver issues #1137
base: release-0.6
Are you sure you want to change the base?
Conversation
#ifdef CONFIG_AVM_ENABLE_NETWORK_PORT_DRIVER | ||
|
||
REGISTER_PORT_DRIVER(network, network_driver_init, NULL, network_driver_create_port) | ||
REGISTER_PORT_DRIVER(network, network_driver_init, network_driver_stop, network_driver_create_port) |
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.
network_driver_stop
will not be called when calling network:stop/0
. It gets called during tests (when GlobalContext is destoryed and recreated).
So this change sounds correct, but it doesn't do what you are saying.
908bd03
to
40b8959
Compare
Thank you for the explanation of the These problems have all been fixed, and the driver shuts down and exits cleanly. There is still one ESP-IDF message (in some builds, depending on the IDF version) in the console logs that is being reported as an error:
I looked into this and it is actually a known ESP-IDF issue, that will be changed to an information message in a future update. See espressif/esp-idf#12473. |
40b8959
to
8eb624e
Compare
8eb624e
to
a222bd4
Compare
Removes several possible uses of free() on memory that had been previously free'd. This would happen under specific error conditions in the `start_network` function in network_driver.c that `network:start/1` uses to configure and start the network. Signed-off-by: Winford <winford@object.stream>
…SP32 Adds a destroy callback to the ESP32 network driver to completely stop the driver and free all network resources when network:stop/0 is used. Previosly the driver was not being stopped internally and resources were not freed when the gen_server was stopped, causing instability, and possible crashes when event callbacks were triggered, but there was no process alive to handle them. Closes atomvm#643 Signed-off-by: Winford <winford@object.stream>
Adds an event handler for `event 21` the `WIFI_EVENT_STA_BEACON_TIMEOUT` event and an option to add an Erlang callback handler for the event. The event will be logged with an info level message that includes a suggestion about the two most likely causes, poor rssi and network congestion. A callback config option `{beacon_timeout, fun()}` may be added to the `sta` config. Closes atomvm#1100 Signed-off-by: Winford <winford@object.stream>
a222bd4
to
dfa2f88
Compare
These changes close the following issues for the ESP32 network driver:
network:stop/0
#643] When network:stop/0 is used the driver is now completely stopped and all resources are freed.These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later