Skip to content

Commit 7fd7ca6

Browse files
committed
WiFiServer: fix error when calling close more than once
1 parent 533a600 commit 7fd7ca6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/ESP8266WiFi/src/WiFiServer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ WiFiServer::WiFiServer(uint16_t port)
5656
}
5757

5858
void WiFiServer::begin() {
59+
close();
5960
err_t err;
6061
tcp_pcb* pcb = tcp_new();
6162
if (!pcb)
@@ -118,6 +119,7 @@ void WiFiServer::close() {
118119
return;
119120
}
120121
tcp_close(_pcb);
122+
_pcb = nullptr;
121123
}
122124

123125
void WiFiServer::stop() {

0 commit comments

Comments
 (0)