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 <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-06-19 11:49:19 +03:00
commit 210c30805b

View file

@ -433,10 +433,12 @@ int net_context_put(struct net_context *context)
if ((net_context_get_state(context) == NET_CONTEXT_CONNECTED || if ((net_context_get_state(context) == NET_CONTEXT_CONNECTED ||
net_context_get_state(context) == NET_CONTEXT_LISTENING) net_context_get_state(context) == NET_CONTEXT_LISTENING)
&& !context->tcp->fin_rcvd) { && !context->tcp->fin_rcvd) {
NET_DBG("TCP connection in active close, not " if (IS_ENABLED(CONFIG_NET_TCP_TIME_WAIT)) {
"disposing yet"); NET_DBG("TCP connection in active close, not "
queue_fin(context); "disposing yet");
return 0; queue_fin(context);
return 0;
}
} }
} }
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */