diff --git a/CHANGELOG b/CHANGELOG index 9f87ed05..a350b06f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -216,6 +216,10 @@ HISTORY ++ Bugfixes: + 2015-03-21: Simon Goldschmidt + * tcp_in.c: fixed bug #38468 (tcp_sent() not called on half-open connection for + data ACKed with the same ack as FIN) + 2015-03-21: Simon Goldschmidt (patch by Christoffer Lind) * dhcp.h/.c: fixed bug #38204 (DHCP lease time not handled correctly) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 829166d5..cd2a3b9b 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -360,17 +360,6 @@ tcp_input(struct pbuf *p, struct netif *inp) TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_RST); tcp_pcb_remove(&tcp_active_pcbs, pcb); memp_free(MEMP_TCP_PCB, pcb); - } else if (recv_flags & TF_CLOSED) { - /* The connection has been closed and we will deallocate the - PCB. */ - if (!(pcb->flags & TF_RXCLOSED)) { - /* Connection closed although the application has only shut down the - tx side: call the PCB's err callback and indicate the closure to - ensure the application doesn't continue using the PCB. */ - TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_CLSD); - } - tcp_pcb_remove(&tcp_active_pcbs, pcb); - memp_free(MEMP_TCP_PCB, pcb); } else { err = ERR_OK; /* If the application has registered a "sent" function to be @@ -395,7 +384,19 @@ tcp_input(struct pbuf *p, struct netif *inp) } } } - + if (recv_flags & TF_CLOSED) { + /* The connection has been closed and we will deallocate the + PCB. */ + if (!(pcb->flags & TF_RXCLOSED)) { + /* Connection closed although the application has only shut down the + tx side: call the PCB's err callback and indicate the closure to + ensure the application doesn't continue using the PCB. */ + TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_CLSD); + } + tcp_pcb_remove(&tcp_active_pcbs, pcb); + memp_free(MEMP_TCP_PCB, pcb); + goto aborted; + } #if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE while (recv_data != NULL) { struct pbuf *rest = NULL;