Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP8285 generic (TYWE2S)
- Core Version: bb79e90 (2024-12-08)
- Development Env: Arduino IDE
- Operating System: Linux (Arch)
Settings in IDE
- Module: Generic ESP8266 Module
- Flash Mode: other
- Flash Size: 1MB
- lwip Variant: ?
- Reset Method: manual (a bit of wire)
- Flash Frequency: ?
- CPU Frequency: 24Mhz
- Upload Using: Generic FTDI adapter
- Upload Speed: 115200
Problem Description
WiFiServer appears to have an empty destructor, and does not automatically call stop()
or end()
when deleted like esp32 does.
Depending on the project, this may cause the port listen to fail on the 2nd and subsequent attempts if for example, WiFi is connected, a port is listened, the WiFi connection is lost, and then a connection is re-established and begin()
is called again on a new WiFiServer object with the same port.
If the project didn't check for success after calling begin()
(this isn't exposed very well, so I'm using status() != CLOSED
to infer the result of the internal test !listen_pcb
), then the device can even appear to re-connect but then reboot via abort()
on the subsequent first incoming connection.
Expected Behavior
I would expect that WiFiServer's destructor should clean up all owned resources as is C++ convention, so that projects that don't use it as a singleton can delete
and new
it again to reset the state without any memory or resource leaks.