From ddade99c43cb38ff3e2499877902b2c60ad69b96 Mon Sep 17 00:00:00 2001 From: Sven Steckmann Date: Thu, 17 Oct 2019 12:57:28 +0200 Subject: [PATCH] DNS server stop independent of webserver type In some situations (not passing a WebServer instance from external) the DNS server was not stopped in _stopPortal(). Maybe the intention was here not to stopped an externally passed WebServer but I see no use-case for the dns server here. Fixed this to remove the enum handling in the next step. --- src/AutoConnect.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index 0c5a046..bedce03 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -385,13 +385,11 @@ void AutoConnect::end(void) { } _stopPortal(); + _dnsServer.reset(); + if (_webServer) { switch (_webServerAlloc) { case AC_WEBSERVER_HOSTED: - if (_dnsServer) { - _dnsServer->stop(); - _dnsServer.reset(); - } _webServer.reset(); break; case AC_WEBSERVER_PARASITIC: @@ -686,7 +684,7 @@ bool AutoConnect::_loadAvailCredential(const char* ssid) { * Stops DNS server and flush tcp sending. */ void AutoConnect::_stopPortal(void) { - if (_dnsServer && _webServerAlloc == AC_WEBSERVER_HOSTED) + if (_dnsServer) _dnsServer->stop(); if (_webServer) {