summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-08-31 14:31:41 -0700
committerDamjan Marion <dmarion@me.com>2018-09-06 08:35:51 +0000
commitab2f6dbf9f7b7164a9810f4c80c8abf8463e42ad (patch)
tree7fb4dd4c70bef17f09a88130eeadeeca86b6d09c /src/vnet/session/session_api.c
parented234e7f151b05a5b8375dbd9f0add24fe8ebf2f (diff)
session: support multiple worker binds
Allows app workers to listen on the same session endpoint. Incoming connects are spread across the workers in a round-robin fashion Change-Id: Ib5f5817230d9abc6127a85cdbdcad70d980c0f7f Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-xsrc/vnet/session/session_api.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 78c05c34431..aa29090383a 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -255,7 +255,7 @@ send_session_accept_callback (stream_session_t * s)
}
else
{
- ll = application_get_local_listen_session (server_wrk,
+ ll = application_get_local_listen_session (server,
ls->listener_index);
if (ll->transport_listener_index != ~0)
{
@@ -445,7 +445,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_ACCEPTED;
mp = (session_accepted_msg_t *) evt->data;
- mp->context = app_wrk->wrk_index;
+ mp->context = app->app_index;
mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
@@ -489,9 +489,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
}
else
{
- ll =
- application_get_local_listen_session (app_wrk,
- ls->listener_index);
+ ll = application_get_local_listen_session (app, ls->listener_index);
if (ll->transport_listener_index != ~0)
{
listener = listen_session_get (ll->transport_listener_index);
@@ -687,7 +685,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
else
{
local_session_t *local;
- local = application_get_local_listen_session_from_handle (handle);
+ local = application_get_local_listener_w_handle (handle);
mp->lcl_port = local->port;
mp->lcl_is_ip4 = session_type_is_ip4 (local->session_type);
}
@@ -1239,6 +1237,7 @@ vl_api_unbind_sock_t_handler (vl_api_unbind_sock_t * mp)
{
a->app_index = app->app_index;
a->handle = mp->handle;
+ a->wrk_map_index = mp->wrk_index;
if ((error = vnet_unbind (a)))
{
rv = clib_error_get_code (error);
@@ -1255,7 +1254,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
{
vl_api_connect_session_reply_t *rmp;
vnet_connect_args_t _a, *a = &_a;
- application_t *app;
+ application_t *app = 0;
clib_error_t *error = 0;
int rv = 0;
@@ -1307,6 +1306,12 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
done:
REPLY_MACRO (VL_API_CONNECT_SESSION_REPLY);
+
+ if (app && application_use_mq_for_ctrl (app))
+ {
+ app_worker_t *app_wrk = application_get_worker (app, mp->wrk_index);
+ mq_send_session_connected_cb (app_wrk->wrk_index, mp->context, 0, 1);
+ }
}
static void