Web: delay WiFi shutdown and reorder stop logs
This fixes accidental crash when disabling the web panel without an active MQTT uplink. When the web panel was disabled, isWebEnabled() immediately returned false. If no other network consumer was active, network.loop(false) tore down WiFi *before* web.loop() stopped the httpd server. Calling httpd_stop() while WiFi was being freed sometimes caused a LoadProhibited panic (ieee80211_output_do -> wifi_free). This only occurred when the server was stopped after WiFi teardown began. Fix by including _panel.isRunning() in isWebEnabled(): WiFi stays up for one extra iteration, so the server is stopped while the stack is still valid. Only on the next loop cycle does the network shut down. Additionally, move the "server stopped" and "redirect server stopped" log messages to after the actual httpd_stop() / httpd_ssl_stop() calls. This prevents a misleading "stopped" message if a crash happens during teardown.
Этот коммит содержится в:
@@ -2645,9 +2645,9 @@ bool WebPanelServer::start() {
|
||||
void WebPanelServer::stop() {
|
||||
stopRedirectServer();
|
||||
if (_server != nullptr) {
|
||||
WEB_PANEL_LOG("server stopped");
|
||||
httpd_ssl_stop(_server);
|
||||
_server = nullptr;
|
||||
WEB_PANEL_LOG("server stopped");
|
||||
}
|
||||
_token[0] = 0;
|
||||
_last_activity_ms = 0;
|
||||
@@ -2663,9 +2663,9 @@ bool WebPanelServer::hasSessionToken() const {
|
||||
|
||||
void WebPanelServer::stopRedirectServer() {
|
||||
if (_redirect_server != nullptr) {
|
||||
WEB_PANEL_LOG("redirect server stopped");
|
||||
httpd_stop(_redirect_server);
|
||||
_redirect_server = nullptr;
|
||||
WEB_PANEL_LOG("redirect server stopped");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user