tcp: fix bug #36167 again (fixed in 2014, but when calling shutdown(WR) followed by recv(), this still happened)

This commit is contained in:
goldsimon 2017-11-17 21:06:49 +01:00
parent 926805bcf1
commit fa73f130f1
2 changed files with 3 additions and 1 deletions

View File

@ -919,7 +919,7 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
pcb->rcv_wnd = TCP_WND_MAX(pcb);
} else if (pcb->rcv_wnd == 0) {
/* rcv_wnd overflowed */
if ((pcb->state == CLOSE_WAIT) || (pcb->state == LAST_ACK)) {
if (TCP_STATE_IS_CLOSING(pcb->state)) {
/* In passive close, we allow this, since the FIN bit is added to rcv_wnd
by the stack itself, since it is not mandatory for an application
to call tcp_recved() for the FIN bit, but e.g. the netconn API does so. */

View File

@ -66,6 +66,8 @@ enum tcp_state {
LAST_ACK = 9,
TIME_WAIT = 10
};
/* ATTENTION: this depends on state number ordering! */
#define TCP_STATE_IS_CLOSING(state) ((state) >= FIN_WAIT_1)
/* Flags for "apiflags" parameter in tcp_write */
#define TCP_WRITE_FLAG_COPY 0x01