diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 9368d74da73..cb9c9fb460d 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -422,7 +422,9 @@ int net_context_put(struct net_context *context) #if defined(CONFIG_NET_TCP) if (net_context_get_ip_proto(context) == IPPROTO_TCP) { - if (!context->tcp->fin_rcvd) { + if ((net_context_get_state(context) == NET_CONTEXT_CONNECTED || + net_context_get_state(context) == NET_CONTEXT_LISTENING) + && !context->tcp->fin_rcvd) { NET_DBG("TCP connection in active close, not " "disposing yet"); queue_fin(context);