Skip to content

Commit

Permalink
Fix call to tcp_recved after pcb has been closed, abort connections c…
Browse files Browse the repository at this point in the history
…losed by the remote side
  • Loading branch information
igrr committed Jan 13, 2015
1 parent c17e868 commit 7d1de31
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libraries/ESP8266WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ class ClientContext
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;
Expand All @@ -203,7 +204,8 @@ class ClientContext
_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);
}
}
Expand All @@ -218,8 +220,8 @@ class ClientContext
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);
Expand Down

0 comments on commit 7d1de31

Please sign in to comment.