mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-06-05 21:04:45 +00:00
tcp_in: Flag the pcb as closing if TCP_EVENT_CLOSED refused
If the packet contained FIN flag, we post a TCP_EVENT_CLOSE with null pbuf, which could get lost if the underlying platform implementation of sys_mbox_(try)post() returns ERR_MEM (i.e. won't fit into the recv mailbox). Loosing this event causes trouble since the FIN initiator gets ACK'ed and assumes the connection has closed, but the TCP state machine is stuck in its active state. Fixed by flagging the pcb as closing if the ERR_MEM returned. Picked from espressif/esp-lwip@d050c331 Patch posted https://savannah.nongnu.org/patch/?10013 Ref IDF-4847
This commit is contained in:
@@ -541,6 +541,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
TCP_EVENT_CLOSED(pcb, err);
|
||||
if (err == ERR_ABRT) {
|
||||
goto aborted;
|
||||
} else if (err == ERR_MEM) {
|
||||
tcp_set_flags(pcb, TF_CLOSEPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user