mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +00:00
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
This commit is contained in:
1 parent
57a4ec31d1
commit
06c5c4d2a4
1 file changed
+1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user