1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Merge pull request #1189 from Links2004/master

fix #1167 WiFiServer stop / close
This commit is contained in:
Markus 2015-12-10 15:41:04 +01:00
commit a5c3aea98e
4 changed files with 24 additions and 0 deletions

View File

@ -71,6 +71,7 @@ ESP8266WebServer::~ESP8266WebServer() {
delete handler;
handler = next;
}
close();
}
void ESP8266WebServer::begin() {
@ -173,6 +174,14 @@ void ESP8266WebServer::handleClient() {
_handleRequest();
}
void ESP8266WebServer::close() {
_server.close();
}
void ESP8266WebServer::stop() {
close();
}
void ESP8266WebServer::sendHeader(const String& name, const String& value, bool first) {
String headerLine = name;
headerLine += ": ";

View File

@ -66,6 +66,9 @@ public:
void begin();
void handleClient();
void close();
void stop();
bool authenticate(const char * username, const char * password);
void requestAuthentication();

View File

@ -121,6 +121,16 @@ uint8_t WiFiServer::status() {
return _pcb->state;
}
void WiFiServer::close() {
if (!_pcb) {
return;
}
tcp_close(_pcb);
}
void WiFiServer::stop() {
close();
}
size_t WiFiServer::write(uint8_t b) {
return write(&b, 1);

View File

@ -54,6 +54,8 @@ public:
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
uint8_t status();
void close();
void stop();
using Print::write;