Let FIN come through although TF_RXCLOSED is set, send RST when data is received although TF_RXCLOSED is set, added TCP_EVENT_CLOSED for clearer code

This commit is contained in:
goldsimon
2010-05-15 18:12:37 +00:00
parent 874d1641df
commit a880709776
2 changed files with 27 additions and 10 deletions

View File

@@ -346,7 +346,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
}
if (recv_data != NULL) {
if(flags & TCP_PSH) {
if (pcb->flags & TF_RXCLOSED) {
/* received data although already closed -> abort (send RST) to
notify the remote host that not all data has been processed */
tcp_abort(pcb);
goto aborted;
}
if (flags & TCP_PSH) {
recv_data->flags |= PBUF_FLAG_PUSH;
}
@@ -371,7 +377,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
if (pcb->rcv_wnd != TCP_WND) {
pcb->rcv_wnd++;
}
TCP_EVENT_RECV(pcb, NULL, ERR_OK, err);
TCP_EVENT_CLOSED(pcb, err);
if (err == ERR_ABRT) {
goto aborted;
}
@@ -391,7 +397,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
Below this line, 'pcb' may not be dereferenced! */
aborted:
tcp_input_pcb = NULL;
recv_data = NULL;
/* give up our reference to inseg.p */
if (inseg.p != NULL)