Skip to content

stopWebServer() is a complete no-op on both ESP8266 and ESP32 #67

Description

@davidchatting-bot

Where

`YoYoWiFiManager::stopWebServer()` in `src/YoYoWiFiManager.cpp`:
```cpp
void YoYoWiFiManager::stopWebServer() {
//TODO: this is crashing on the ESP8266:
if(webserver != NULL) {
// Serial.println("stopWebServer");
// webserver -> end();
// delete(webserver);
// webserver = NULL;
}
}
```

Problem

The comment says this crashes "on the ESP8266", but the entire body is commented out with no `#if defined(ESP8266)` guard - so it's a no-op on ESP32 too, not just ESP8266. `updateMode()` calls this whenever transitioning into `YY_MODE_CLIENT` if `stopWebServerOnceConnected` is true (which is the default value passed to `init()`), so on every board, the webserver just silently never stops when a sketch asks for that behaviour.

Ask

  • Track down why `webserver->end(); delete(webserver);` crashes on ESP8266 specifically, and fix that (likely needs the async webserver to be idle/no in-flight requests before deleting - may need a small delay/guard rather than deleting synchronously).
  • Guard the still-broken platform behind `#if defined(ESP8266)` (or fix it there too) so ESP32 at least gets working behaviour rather than inheriting the ESP8266 workaround unconditionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions