diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 07f297affad23..4c9d7c505dc75 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -1616,6 +1616,12 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, */ conn->tcpstateflags = TCP_CLOSED; + + /* In the TCP_FIN_WAIT_1, we need call tcp_close_eventhandler to + * release nofosegs, that we received in this state. + */ + + tcp_callback(dev, conn, TCP_CLOSE); tcp_reset(dev, conn); return; } @@ -1649,6 +1655,12 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, */ conn->tcpstateflags = TCP_CLOSED; + + /* In the TCP_FIN_WAIT_2, we need call tcp_close_eventhandler to + * release nofosegs, that we received in this state. + */ + + tcp_callback(dev, conn, TCP_CLOSE); tcp_reset(dev, conn); return; }