aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-07 09:13:15 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-09-07 21:30:44 +0000
commit74cac8839efae6a69baea031fb01602ef8907e8a (patch)
treec94cc43b74ef84f500664821df3338e4b7668e49 /src/vnet/session
parentd790c7e1fa5f1accb621aa75089212be586c137f (diff)
session: fix reentrant listens
Change-Id: I72d400401a308012b43513179870823f6f921e44 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.c13
-rw-r--r--src/vnet/session/session.c8
2 files changed, 13 insertions, 8 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 8cf32896631..3811091f05c 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -762,10 +762,12 @@ application_start_listen (application_t * app,
sep_ext->is_ip4);
ls = listen_session_new (0, sst);
ls->app_index = app->app_index;
-
+ lh = listen_session_get_handle (ls);
if (session_listen (ls, sep_ext))
goto err;
+
+ ls = listen_session_get_from_handle (lh);
app_listener = app_listener_alloc (app);
ls->listener_db_index = app_listener->al_index;
@@ -779,7 +781,7 @@ application_start_listen (application_t * app,
app_listener->workers = clib_bitmap_set (app_listener->workers,
app_wrk->wrk_map_index, 1);
- *res = listen_session_get_handle (ls);
+ *res = lh;
return 0;
err:
@@ -1924,9 +1926,10 @@ format_app_worker_listener (u8 * s, va_list * args)
if (verbose)
{
- s = format (s, "%-40s%-25s%=10u%-15u%-15u%-10u", str, app_name,
- app_wrk->wrk_map_index, app->api_client_index, handle,
- sm_index);
+ char buf[32];
+ sprintf (buf, "%u(%u)", app_wrk->wrk_map_index, app_wrk->wrk_index);
+ s = format (s, "%-40s%-25s%=10s%-15u%-15u%-10u", str, app_name,
+ buf, app->api_client_index, handle, sm_index);
}
else
s = format (s, "%-40s%-25s%=10u", str, app_name, app_wrk->wrk_map_index);
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 952a5a90141..c5b2124acbd 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -984,21 +984,23 @@ session_listen (stream_session_t * ls, session_endpoint_extended_t * sep)
{
transport_connection_t *tc;
transport_endpoint_t *tep;
- u32 tc_index;
+ u32 tc_index, s_index;
/* Transport bind/listen */
tep = session_endpoint_to_transport (sep);
- tc_index = tp_vfts[sep->transport_proto].bind (ls->session_index, tep);
+ s_index = ls->session_index;
+ tc_index = tp_vfts[sep->transport_proto].bind (s_index, tep);
if (tc_index == (u32) ~ 0)
return -1;
/* Attach transport to session */
+ ls = listen_session_get (s_index);
ls->connection_index = tc_index;
/* Add to the main lookup table after transport was initialized */
tc = tp_vfts[sep->transport_proto].get_listener (tc_index);
- session_lookup_add_connection (tc, ls->session_index);
+ session_lookup_add_connection (tc, s_index);
return 0;
}