From 1d764a87a687a90eef0c462820fb920e9296a6fc Mon Sep 17 00:00:00 2001 From: Juraj Andrassy Date: Sat, 23 Sep 2023 14:01:05 +0200 Subject: [PATCH] WiFiServer - operator bool() and method end() --- libraries/ESP8266WiFi/src/WiFiServer.cpp | 8 ++++++++ libraries/ESP8266WiFi/src/WiFiServer.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/libraries/ESP8266WiFi/src/WiFiServer.cpp b/libraries/ESP8266WiFi/src/WiFiServer.cpp index 884065920c..462dbd7f74 100644 --- a/libraries/ESP8266WiFi/src/WiFiServer.cpp +++ b/libraries/ESP8266WiFi/src/WiFiServer.cpp @@ -173,6 +173,14 @@ void WiFiServer::stop() { close(); } +void WiFiServer::end() { + close(); +} + +WiFiServer::operator bool() { + return (status() != CLOSED); +} + err_t WiFiServer::_accept(tcp_pcb* apcb, err_t err) { (void) err; DEBUGV("WS:ac\r\n"); diff --git a/libraries/ESP8266WiFi/src/WiFiServer.h b/libraries/ESP8266WiFi/src/WiFiServer.h index ac6ad40aaf..049aa9f9d0 100644 --- a/libraries/ESP8266WiFi/src/WiFiServer.h +++ b/libraries/ESP8266WiFi/src/WiFiServer.h @@ -100,6 +100,8 @@ class WiFiServer { uint16_t port() const; void close(); void stop(); + void end(); + explicit operator bool(); using ClientType = WiFiClient;