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

Empty destructor in WifiServer::~WiFiServer() #9212

Open
6 tasks done
rogueeve575 opened this issue Dec 9, 2024 · 0 comments
Open
6 tasks done

Empty destructor in WifiServer::~WiFiServer() #9212

rogueeve575 opened this issue Dec 9, 2024 · 0 comments

Comments

@rogueeve575
Copy link

rogueeve575 commented Dec 9, 2024

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.

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

No branches or pull requests

1 participant