Skip to content

Commit 7d1de31

Browse files
committed
Fix call to tcp_recved after pcb has been closed, abort connections closed by the remote side
1 parent c17e868 commit 7d1de31

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libraries/ESP8266WiFi/src/include/ClientContext.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ class ClientContext
191191
else if (!_rx_buf->next)
192192
{
193193
DEBUGV(":c0 %d, %d\r\n", size, _rx_buf->tot_len);
194-
tcp_recved(_pcb, _rx_buf->len);
194+
if (_pcb)
195+
tcp_recved(_pcb, _rx_buf->len);
195196
pbuf_free(_rx_buf);
196197
_rx_buf = 0;
197198
_rx_buf_offset = 0;
@@ -203,7 +204,8 @@ class ClientContext
203204
_rx_buf = _rx_buf->next;
204205
_rx_buf_offset = 0;
205206
pbuf_ref(_rx_buf);
206-
tcp_recved(_pcb, head->len);
207+
if (_pcb)
208+
tcp_recved(_pcb, head->len);
207209
pbuf_free(head);
208210
}
209211
}
@@ -218,8 +220,8 @@ class ClientContext
218220
tcp_sent(pcb, NULL);
219221
tcp_recv(pcb, NULL);
220222
tcp_err(pcb, NULL);
221-
int error = tcp_close(pcb);
222-
if (error != ERR_OK)
223+
// int error = tcp_close(pcb);
224+
// if (error != ERR_OK)
223225
{
224226
DEBUGV(":rcla\r\n");
225227
tcp_abort(pcb);

0 commit comments

Comments
 (0)