Commit 06c5c4d2 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Handle NULL tpcb in mg_lwip_tcp_write

This can happen if the underlying LWIP TCP PCB has been destroyed (we got tcp_error_cb).

PUBLISHED_FROM=7a060aa4ca2a0c5a818fe9bc6b08cd0733c0ef8f
parent 57a4ec31
......@@ -14313,6 +14313,7 @@ int mg_lwip_tcp_write(struct mg_connection *nc, const void *data,
uint16_t len) {
struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;
struct tcp_pcb *tpcb = cs->pcb.tcp;
if (tpcb == NULL) return -1;
len = MIN(tpcb->mss, MIN(len, tpcb->snd_buf));
if (len == 0) {
DBG(("%p no buf avail %u %u %u %p %p", tpcb, tpcb->acked, tpcb->snd_buf,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment