session/tcp: postpone cleanup on reset
Change-Id: I45fd7538853f84c6c8bf804cc20acbc9601db3ba Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:

committed by
Dave Barach

parent
01fdbcca13
commit
4af830cd7b
@ -424,9 +424,15 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
|
|||||||
static void
|
static void
|
||||||
echo_clients_session_reset_callback (stream_session_t * s)
|
echo_clients_session_reset_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
|
echo_client_main_t *ecm = &echo_client_main;
|
||||||
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
|
|
||||||
if (s->session_state == SESSION_STATE_READY)
|
if (s->session_state == SESSION_STATE_READY)
|
||||||
clib_warning ("Reset active connection %U", format_stream_session, s, 2);
|
clib_warning ("Reset active connection %U", format_stream_session, s, 2);
|
||||||
stream_session_cleanup (s);
|
|
||||||
|
a->handle = session_handle (s);
|
||||||
|
a->app_index = ecm->app_index;
|
||||||
|
vnet_disconnect_session (a);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +446,7 @@ static void
|
|||||||
echo_clients_session_disconnect_callback (stream_session_t * s)
|
echo_clients_session_disconnect_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
echo_client_main_t *ecm = &echo_client_main;
|
echo_client_main_t *ecm = &echo_client_main;
|
||||||
vnet_disconnect_args_t _a, *a = &_a;
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
a->handle = session_handle (s);
|
a->handle = session_handle (s);
|
||||||
a->app_index = ecm->app_index;
|
a->app_index = ecm->app_index;
|
||||||
vnet_disconnect_session (a);
|
vnet_disconnect_session (a);
|
||||||
@ -451,7 +457,7 @@ void
|
|||||||
echo_clients_session_disconnect (stream_session_t * s)
|
echo_clients_session_disconnect (stream_session_t * s)
|
||||||
{
|
{
|
||||||
echo_client_main_t *ecm = &echo_client_main;
|
echo_client_main_t *ecm = &echo_client_main;
|
||||||
vnet_disconnect_args_t _a, *a = &_a;
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
a->handle = session_handle (s);
|
a->handle = session_handle (s);
|
||||||
a->app_index = ecm->app_index;
|
a->app_index = ecm->app_index;
|
||||||
vnet_disconnect_session (a);
|
vnet_disconnect_session (a);
|
||||||
@ -552,6 +558,7 @@ echo_clients_detach ()
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
da->app_index = ecm->app_index;
|
da->app_index = ecm->app_index;
|
||||||
|
da->api_client_index = ~0;
|
||||||
rv = vnet_application_detach (da);
|
rv = vnet_application_detach (da);
|
||||||
ecm->test_client_attached = 0;
|
ecm->test_client_attached = 0;
|
||||||
ecm->app_index = ~0;
|
ecm->app_index = ~0;
|
||||||
|
@ -73,7 +73,7 @@ void
|
|||||||
echo_server_session_disconnect_callback (stream_session_t * s)
|
echo_server_session_disconnect_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
echo_server_main_t *esm = &echo_server_main;
|
echo_server_main_t *esm = &echo_server_main;
|
||||||
vnet_disconnect_args_t _a, *a = &_a;
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
|
|
||||||
a->handle = session_handle (s);
|
a->handle = session_handle (s);
|
||||||
a->app_index = esm->app_index;
|
a->app_index = esm->app_index;
|
||||||
@ -83,8 +83,12 @@ echo_server_session_disconnect_callback (stream_session_t * s)
|
|||||||
void
|
void
|
||||||
echo_server_session_reset_callback (stream_session_t * s)
|
echo_server_session_reset_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
|
echo_server_main_t *esm = &echo_server_main;
|
||||||
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
clib_warning ("Reset session %U", format_stream_session, s, 2);
|
clib_warning ("Reset session %U", format_stream_session, s, 2);
|
||||||
stream_session_cleanup (s);
|
a->handle = session_handle (s);
|
||||||
|
a->app_index = esm->app_index;
|
||||||
|
vnet_disconnect_session (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -435,7 +435,7 @@ static void
|
|||||||
http_server_session_disconnect_callback (stream_session_t * s)
|
http_server_session_disconnect_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
http_server_main_t *bsm = &http_server_main;
|
http_server_main_t *bsm = &http_server_main;
|
||||||
vnet_disconnect_args_t _a, *a = &_a;
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
|
|
||||||
a->handle = session_handle (s);
|
a->handle = session_handle (s);
|
||||||
a->app_index = bsm->app_index;
|
a->app_index = bsm->app_index;
|
||||||
@ -445,8 +445,11 @@ http_server_session_disconnect_callback (stream_session_t * s)
|
|||||||
static void
|
static void
|
||||||
http_server_session_reset_callback (stream_session_t * s)
|
http_server_session_reset_callback (stream_session_t * s)
|
||||||
{
|
{
|
||||||
clib_warning ("called.. ");
|
http_server_main_t *htm = &http_server_main;
|
||||||
stream_session_cleanup (s);
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
|
a->handle = session_handle (s);
|
||||||
|
a->app_index = htm->app_index;
|
||||||
|
vnet_disconnect_session (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -835,7 +835,7 @@ stream_session_reset_notify (transport_connection_t * tc)
|
|||||||
app_worker_t *app_wrk;
|
app_worker_t *app_wrk;
|
||||||
application_t *app;
|
application_t *app;
|
||||||
s = session_get (tc->s_index, tc->thread_index);
|
s = session_get (tc->s_index, tc->thread_index);
|
||||||
s->session_state = SESSION_STATE_CLOSED;
|
svm_fifo_dequeue_drop_all (s->server_tx_fifo);
|
||||||
app_wrk = app_worker_get (s->app_wrk_index);
|
app_wrk = app_worker_get (s->app_wrk_index);
|
||||||
app = application_get (app_wrk->app_index);
|
app = application_get (app_wrk->app_index);
|
||||||
app->cb_fns.session_reset_callback (s);
|
app->cb_fns.session_reset_callback (s);
|
||||||
|
@ -1063,6 +1063,7 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
|
|||||||
static void
|
static void
|
||||||
vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
|
vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
|
||||||
{
|
{
|
||||||
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
app_worker_t *app_wrk;
|
app_worker_t *app_wrk;
|
||||||
application_t *app;
|
application_t *app;
|
||||||
stream_session_t *s;
|
stream_session_t *s;
|
||||||
@ -1097,7 +1098,9 @@ vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
|
|||||||
|
|
||||||
/* This comes as a response to a reset, transport only waiting for
|
/* This comes as a response to a reset, transport only waiting for
|
||||||
* confirmation to remove connection state, no need to disconnect */
|
* confirmation to remove connection state, no need to disconnect */
|
||||||
stream_session_cleanup (s);
|
a->handle = mp->handle;
|
||||||
|
a->app_index = app->app_index;
|
||||||
|
vnet_disconnect_session (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -84,6 +84,7 @@ session_mq_accepted_reply_handler (void *data)
|
|||||||
static void
|
static void
|
||||||
session_mq_reset_reply_handler (void *data)
|
session_mq_reset_reply_handler (void *data)
|
||||||
{
|
{
|
||||||
|
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
|
||||||
session_reset_reply_msg_t *mp;
|
session_reset_reply_msg_t *mp;
|
||||||
app_worker_t *app_wrk;
|
app_worker_t *app_wrk;
|
||||||
stream_session_t *s;
|
stream_session_t *s;
|
||||||
@ -119,7 +120,9 @@ session_mq_reset_reply_handler (void *data)
|
|||||||
|
|
||||||
/* This comes as a response to a reset, transport only waiting for
|
/* This comes as a response to a reset, transport only waiting for
|
||||||
* confirmation to remove connection state, no need to disconnect */
|
* confirmation to remove connection state, no need to disconnect */
|
||||||
stream_session_cleanup (s);
|
a->handle = mp->handle;
|
||||||
|
a->app_index = app->app_index;
|
||||||
|
vnet_disconnect_session (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -296,6 +296,7 @@ tcp_connection_reset (tcp_connection_t * tc)
|
|||||||
case TCP_STATE_CLOSED:
|
case TCP_STATE_CLOSED:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
tc->state = TCP_STATE_CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -349,6 +350,9 @@ tcp_connection_close (tcp_connection_t * tc)
|
|||||||
case TCP_STATE_FIN_WAIT_1:
|
case TCP_STATE_FIN_WAIT_1:
|
||||||
tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, TCP_2MSL_TIME);
|
tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, TCP_2MSL_TIME);
|
||||||
break;
|
break;
|
||||||
|
case TCP_STATE_CLOSED:
|
||||||
|
tcp_connection_timers_reset (tc);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
TCP_DBG ("state: %u", tc->state);
|
TCP_DBG ("state: %u", tc->state);
|
||||||
}
|
}
|
||||||
@ -553,6 +557,7 @@ tcp_init_snd_vars (tcp_connection_t * tc)
|
|||||||
tc->snd_una = tc->iss;
|
tc->snd_una = tc->iss;
|
||||||
tc->snd_nxt = tc->iss + 1;
|
tc->snd_nxt = tc->iss + 1;
|
||||||
tc->snd_una_max = tc->snd_nxt;
|
tc->snd_una_max = tc->snd_nxt;
|
||||||
|
tc->srtt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1052,7 +1057,8 @@ tcp_snd_space_inline (tcp_connection_t * tc)
|
|||||||
{
|
{
|
||||||
int snd_space, snt_limited;
|
int snd_space, snt_limited;
|
||||||
|
|
||||||
if (PREDICT_FALSE (tcp_in_fastrecovery (tc)))
|
if (PREDICT_FALSE (tcp_in_fastrecovery (tc)
|
||||||
|
|| tc->state == TCP_STATE_CLOSED))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_space = tcp_available_output_snd_space (tc);
|
snd_space = tcp_available_output_snd_space (tc);
|
||||||
|
@ -501,8 +501,8 @@ tcp_estimate_initial_rtt (tcp_connection_t * tc)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mrtt = tcp_time_now_w_thread (thread_index) - tc->rcv_opts.tsecr;
|
mrtt = tcp_time_now_w_thread (thread_index) - tc->rcv_opts.tsecr;
|
||||||
|
mrtt = clib_max (mrtt, 1);
|
||||||
tc->mrtt_us = (f64) mrtt *TCP_TICK;
|
tc->mrtt_us = (f64) mrtt *TCP_TICK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mrtt > 0 && mrtt < TCP_RTT_MAX)
|
if (mrtt > 0 && mrtt < TCP_RTT_MAX)
|
||||||
|
Reference in New Issue
Block a user