mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
tcp_close_shutdown: always deallocate the pcb if there is unread data on close (see bug #52403)
We preserved the TIME_WAIT handling before, but it seems this is not correct: we want to issue a RST later again if someone wants to talk to this port. With TIME_WAIT, this might not always the case.
This commit is contained in:
parent
0853d1e7d1
commit
8c6884b2db
@ -329,19 +329,13 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
|
||||
|
||||
tcp_pcb_purge(pcb);
|
||||
TCP_RMV_ACTIVE(pcb);
|
||||
if (pcb->state == ESTABLISHED) {
|
||||
/* move to TIME_WAIT since we close actively */
|
||||
pcb->state = TIME_WAIT;
|
||||
TCP_REG(&tcp_tw_pcbs, pcb);
|
||||
} else {
|
||||
/* CLOSE_WAIT: deallocate the pcb since we already sent a RST for it */
|
||||
/* Deallocate the pcb since we already sent a RST for it */
|
||||
if (tcp_input_pcb == pcb) {
|
||||
/* prevent using a deallocated pcb: free it from tcp_input later */
|
||||
tcp_trigger_input_pcb_close();
|
||||
} else {
|
||||
memp_free(MEMP_TCP_PCB, pcb);
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user