From 210c30805b9e90f65edc988e92df8324a7a64094 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 19 Jun 2017 11:49:19 +0300 Subject: [PATCH] net: context: Close connection fast if TIME_WAIT support is off If the CONFIG_NET_TCP_TIME_WAIT support is disabled, then do not start to wait for reply to sent FIN in active close, but unref the corresponding net_context in order to close the connection as soon as possible. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_context.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index d402793d02e..3d5de171924 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -433,10 +433,12 @@ int net_context_put(struct net_context *context) 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); - return 0; + if (IS_ENABLED(CONFIG_NET_TCP_TIME_WAIT)) { + NET_DBG("TCP connection in active close, not " + "disposing yet"); + queue_fin(context); + return 0; + } } } #endif /* CONFIG_NET_TCP */