aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-xsrc/vnet/session/session_api.c118
1 files changed, 48 insertions, 70 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index cf5a5cd7fd1..81654e426b5 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -252,15 +252,16 @@ send_session_accept_callback (session_t * s)
}
else
{
- local_session_t *ls = (local_session_t *) s;
- listener = listen_session_get (ls->listener_index);
+ ct_connection_t *ct;
+ ct = (ct_connection_t *) session_get_transport (s);
+ listener = listen_session_get (s->listener_index);
al = app_listener_get (server, listener->al_index);
mp->listener_handle = app_listener_handle (al);
mp->is_ip4 = session_type_is_ip4 (listener->session_type);
- mp->handle = application_local_session_handle (ls);
- mp->port = ls->port;
- mp->vpp_event_queue_address = ls->client_evt_q;
- mp->server_event_queue_address = ls->server_evt_q;
+ mp->handle = session_handle (s);
+ mp->port = ct->c_rmt_port;
+ mp->vpp_event_queue_address = ct->client_evt_q;
+ mp->server_event_queue_address = ct->server_evt_q;
}
vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
@@ -355,11 +356,12 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context,
}
else
{
- local_session_t *ls = (local_session_t *) s;
- mp->handle = application_local_session_handle (ls);
- mp->lcl_port = ls->port;
- mp->vpp_event_queue_address = ls->server_evt_q;
- mp->client_event_queue_address = ls->client_evt_q;
+ ct_connection_t *ct;
+ ct = (ct_connection_t *) session_get_transport (s);
+ mp->handle = session_handle (s);
+ mp->lcl_port = ct->c_lcl_port;
+ mp->vpp_event_queue_address = ct->server_evt_q;
+ mp->client_event_queue_address = ct->client_evt_q;
mp->server_rx_fifo = pointer_to_uword (s->tx_fifo);
mp->server_tx_fifo = pointer_to_uword (s->rx_fifo);
}
@@ -451,24 +453,25 @@ mq_send_session_accepted_cb (session_t * s)
}
else
{
- local_session_t *ls = (local_session_t *) s;
u8 main_thread = vlib_num_workers ()? 1 : 0;
+ ct_connection_t *ct;
+ ct = (ct_connection_t *) session_get_transport (s);
send_app_cut_through_registration_add (app_wrk->api_client_index,
app_wrk->wrk_map_index,
- ls->server_evt_q,
- ls->client_evt_q);
+ ct->server_evt_q,
+ ct->client_evt_q);
- listener = listen_session_get (ls->listener_index);
+ listener = listen_session_get (s->listener_index);
al = app_listener_get (app, listener->al_index);
mp->listener_handle = app_listener_handle (al);
mp->is_ip4 = session_type_is_ip4 (listener->session_type);
- mp->handle = application_local_session_handle (ls);
- mp->port = ls->port;
+ mp->handle = session_handle (s);
+ mp->port = ct->c_rmt_port;
vpp_queue = session_manager_get_vpp_event_queue (main_thread);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
- mp->client_event_queue_address = ls->client_evt_q;
- mp->server_event_queue_address = ls->server_evt_q;
+ mp->client_event_queue_address = ct->client_evt_q;
+ mp->server_event_queue_address = ct->server_evt_q;
}
svm_msg_q_add_and_unlock (app_mq, msg);
@@ -530,20 +533,6 @@ mq_send_session_disconnected_cb (session_t * s)
SESSION_CTRL_EVT_DISCONNECTED);
}
-void
-mq_send_local_session_disconnected_cb (u32 app_wrk_index,
- local_session_t * ls)
-{
- app_worker_t *app_wrk = app_worker_get (app_wrk_index);
- session_handle_t sh = application_local_session_handle (ls);
-
- mq_send_session_close_evt (app_wrk, sh, SESSION_CTRL_EVT_DISCONNECTED);
-
- if (svm_fifo_n_subscribers (ls->rx_fifo))
- mq_notify_close_subscribers (app_wrk->app_index, sh, ls->rx_fifo,
- SESSION_CTRL_EVT_DISCONNECTED);
-}
-
static void
mq_send_session_reset_cb (session_t * s)
{
@@ -590,8 +579,6 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
if (is_fail)
goto done;
- mp->segment_handle = session_segment_handle (s);
-
if (session_has_transport (s))
{
tc = session_get_transport (s);
@@ -609,25 +596,30 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
mp->lcl_port = tc->lcl_port;
mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->segment_handle = session_segment_handle (s);
}
else
{
- local_session_t *ls = (local_session_t *) s;
u8 main_thread = vlib_num_workers ()? 1 : 0;
+ ct_connection_t *cct;
+ session_t *ss;
+ cct = (ct_connection_t *) session_get_transport (s);
send_app_cut_through_registration_add (app_wrk->api_client_index,
app_wrk->wrk_map_index,
- ls->client_evt_q,
- ls->server_evt_q);
+ cct->client_evt_q,
+ cct->server_evt_q);
- mp->handle = application_local_session_handle (ls);
- mp->lcl_port = ls->port;
+ mp->handle = session_handle (s);
+ mp->lcl_port = cct->c_lcl_port;
vpp_mq = session_manager_get_vpp_event_queue (main_thread);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
- mp->client_event_queue_address = ls->client_evt_q;
- mp->server_event_queue_address = ls->server_evt_q;
- mp->server_rx_fifo = pointer_to_uword (s->tx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->rx_fifo);
+ mp->client_event_queue_address = cct->client_evt_q;
+ mp->server_event_queue_address = cct->server_evt_q;
+ ss = ct_session_get_peer (s);
+ mp->server_rx_fifo = pointer_to_uword (ss->tx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (ss->rx_fifo);
+ mp->segment_handle = session_segment_handle (ss);
}
done:
@@ -686,7 +678,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
vpp_evt_q = session_manager_get_vpp_event_queue (0);
mp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
- if (ls && session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
+ if (session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
{
mp->rx_fifo = pointer_to_uword (ls->rx_fifo);
mp->tx_fifo = pointer_to_uword (ls->tx_fifo);
@@ -1087,7 +1079,6 @@ static void
vl_api_accept_session_reply_t_handler (vl_api_accept_session_reply_t * mp)
{
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- local_session_t *ls;
session_t *s;
/* Server isn't interested, kill the session */
@@ -1099,34 +1090,21 @@ vl_api_accept_session_reply_t_handler (vl_api_accept_session_reply_t * mp)
return;
}
- if (session_handle_is_local (mp->handle))
+ s = session_get_from_handle_if_valid (mp->handle);
+ if (!s)
{
- ls = app_worker_get_local_session_from_handle (mp->handle);
- if (!ls || ls->app_wrk_index != mp->context)
- {
- clib_warning ("server %u doesn't own local handle %llu",
- mp->context, mp->handle);
- return;
- }
- if (app_worker_local_session_connect_notify (ls))
- return;
- ls->session_state = SESSION_STATE_READY;
+ clib_warning ("session doesn't exist");
+ return;
}
- else
+ if (s->app_wrk_index != mp->context)
{
- s = session_get_from_handle_if_valid (mp->handle);
- if (!s)
- {
- clib_warning ("session doesn't exist");
- return;
- }
- if (s->app_wrk_index != mp->context)
- {
- clib_warning ("app doesn't own session");
- return;
- }
- s->session_state = SESSION_STATE_READY;
+ clib_warning ("app doesn't own session");
+ return;
}
+ s->session_state = SESSION_STATE_READY;
+
+ if (!session_has_transport (s))
+ ct_session_connect_notify (s);
}
static void