AtomVM icon indicating copy to clipboard operation
AtomVM copied to clipboard

Unexpected behavior in esp32 network driver `network:stop/0`

Open UncleGrumpy opened this issue 2 years ago • 0 comments

Currently using network:stop/0 on esp32 does not actually disconnect or stop the wifi driver, it only stops the gen_server responsible for managing the connection. The expected behavior would be for the network connection to be terminated, and the native wifi driver be stopped, so that all of the resources are freed.

The esp-idf esp_netif driver allows for multiple interfaces simultaneously, including STA mode, AP mode, Ethernet and bluetooth. The current implementation would stop all interfaces, I believe the stop function should be implemented as network:stop/1, and only stop the specified interface. In the case of wifi if both STA and AP are used, and only one is stopped, the driver should remain active. In all other cases the drivers should be completely stopped so that all resources are freed.

UncleGrumpy avatar Jun 18 '23 17:06 UncleGrumpy