Skip to content

Commit 0bad837

Browse files
committed
force tcp close in error
1 parent 03ea7d9 commit 0bad837

File tree

1 file changed

+17
-4
lines changed
  • hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/include

1 file changed

+17
-4
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/include/ClientContext.h

+17-4
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,24 @@ class ClientContext
284284
void _error(err_t err)
285285
{
286286
DEBUGV(":er %d\r\n", err);
287-
_pcb = 0;
288-
if (_size_sent && _send_waiting)
289-
esp_schedule();
290287

291-
}
288+
if(_pcb) {
289+
tcp_arg(_pcb, NULL);
290+
tcp_sent(_pcb, NULL);
291+
tcp_recv(_pcb, NULL);
292+
tcp_err(_pcb, NULL);
293+
err = tcp_close(_pcb);
294+
if(err != ERR_OK) {
295+
DEBUGV(":tc err %d\r\n", err);
296+
tcp_abort(_pcb);
297+
}
298+
}
299+
_pcb = 0;
300+
301+
if(_size_sent && _send_waiting) {
302+
esp_schedule();
303+
}
304+
}
292305

293306
err_t _poll(tcp_pcb* pcb)
294307
{

0 commit comments

Comments
 (0)