From 7d1de31896909658f9c3d28b828c2099f7d27998 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Jan 2015 09:10:32 +0300 Subject: [PATCH] Fix call to tcp_recved after pcb has been closed, abort connections closed by the remote side --- libraries/ESP8266WiFi/src/include/ClientContext.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/ESP8266WiFi/src/include/ClientContext.h b/libraries/ESP8266WiFi/src/include/ClientContext.h index df4788f5e..2ddbc5e15 100644 --- a/libraries/ESP8266WiFi/src/include/ClientContext.h +++ b/libraries/ESP8266WiFi/src/include/ClientContext.h @@ -191,7 +191,8 @@ private: else if (!_rx_buf->next) { DEBUGV(":c0 %d, %d\r\n", size, _rx_buf->tot_len); - tcp_recved(_pcb, _rx_buf->len); + if (_pcb) + tcp_recved(_pcb, _rx_buf->len); pbuf_free(_rx_buf); _rx_buf = 0; _rx_buf_offset = 0; @@ -203,7 +204,8 @@ private: _rx_buf = _rx_buf->next; _rx_buf_offset = 0; pbuf_ref(_rx_buf); - tcp_recved(_pcb, head->len); + if (_pcb) + tcp_recved(_pcb, head->len); pbuf_free(head); } } @@ -218,8 +220,8 @@ private: tcp_sent(pcb, NULL); tcp_recv(pcb, NULL); tcp_err(pcb, NULL); - int error = tcp_close(pcb); - if (error != ERR_OK) + // int error = tcp_close(pcb); + // if (error != ERR_OK) { DEBUGV(":rcla\r\n"); tcp_abort(pcb);