1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

add error reason to WiFiClient debug

handle tcp_close error in unref()
This commit is contained in:
Markus Sattler 2015-04-02 18:57:28 +02:00
parent fb286ff1d4
commit 53dbeeb0aa
2 changed files with 8 additions and 3 deletions

View File

@ -136,7 +136,7 @@ int8_t ICACHE_FLASH_ATTR WiFiClient::_connected(void* pcb, int8_t err)
void ICACHE_FLASH_ATTR WiFiClient::_err(int8_t err) void ICACHE_FLASH_ATTR WiFiClient::_err(int8_t err)
{ {
DEBUGV(":err\r\n"); DEBUGV(":err %d\r\n", err);
esp_schedule(); esp_schedule();
} }

View File

@ -73,6 +73,7 @@ public:
void unref() void unref()
{ {
err_t err;
DEBUGV(":ur %d\r\n", _refcnt); DEBUGV(":ur %d\r\n", _refcnt);
if (--_refcnt == 0) if (--_refcnt == 0)
{ {
@ -82,7 +83,11 @@ public:
tcp_sent(_pcb, NULL); tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL); tcp_recv(_pcb, NULL);
tcp_err(_pcb, NULL); tcp_err(_pcb, NULL);
tcp_close(_pcb); err = tcp_close(_pcb);
if(err != ERR_OK) {
DEBUGV(":tc err %d\r\n", err);
tcp_abort(_pcb);
}
_pcb = 0; _pcb = 0;
} }
delete this; delete this;
@ -269,7 +274,7 @@ private:
void _error(err_t err) void _error(err_t err)
{ {
DEBUGV(":er\r\n"); DEBUGV(":er %d\r\n", err);
_pcb = 0; _pcb = 0;
if (_size_sent && _send_waiting) if (_size_sent && _send_waiting)
esp_schedule(); esp_schedule();