net: tcp2: On active connection close go to FIN_WAIT_1

In order to implement active connection close with the
TIME_WAIT state, send FIN and enter FIN_WAIT_1 state.

We actually send FIN+ACK as most of the implementations do.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
Oleg Zhurakivskyy 2020-03-27 13:09:10 +02:00 committed by Jukka Rissanen
commit 4fbf3c3672

View file

@ -957,7 +957,7 @@ next_state:
k_mutex_unlock(&conn->lock);
}
/* close() has been called on the socket */
/* Active connection close: send FIN and go to FIN_WAIT_1 state */
int net_tcp_put(struct net_context *context)
{
struct tcp *conn = context->tcp;
@ -965,8 +965,9 @@ int net_tcp_put(struct net_context *context)
NET_DBG("%s", conn ? log_strdup(tcp_conn_state(conn, NULL)) : "");
if (conn) {
conn->state = TCP_CLOSE_WAIT;
tcp_in(conn, NULL);
tcp_out(conn, FIN | ACK);
conn_state(conn, TCP_FIN_WAIT_1);
}
net_context_unref(context);