aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-06-13 10:14:28 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-06-17 14:05:37 +0000
commit2f0f96b9dbcb198dede1e5ebd4d880129d5d52c8 (patch)
tree41dc5f84d8fadda65234f5c990dbdc78392b0d91 /src/vnet/session
parent8a2fa3b482b2f32da8e0b634fd09c9bdef2e9443 (diff)
session: use listener_handle instead of listener_index
Type: refactor Change-Id: I97fa59a0ba0b6b7a98698926020ffffcf6ae6ba3 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_local.c4
-rw-r--r--src/vnet/session/application_worker.c2
-rw-r--r--src/vnet/session/session.c5
-rw-r--r--src/vnet/session/session.h2
-rwxr-xr-xsrc/vnet/session/session_api.c4
-rw-r--r--src/vnet/session/session_types.h2
6 files changed, 10 insertions, 9 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index f868e1964cc..2fcf070767c 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -128,7 +128,7 @@ ct_session_connect_notify (session_t * ss)
ss = session_get (ss_index, 0);
cs->session_type = ss->session_type;
cs->connection_index = sct->c_c_index;
- cs->listener_index = SESSION_INVALID_INDEX;
+ cs->listener_handle = SESSION_INVALID_HANDLE;
cs->session_state = SESSION_STATE_CONNECTING;
cs->app_wrk_index = client_wrk->wrk_index;
cs->connection_index = cct->c_c_index;
@@ -280,7 +280,7 @@ ct_connect (app_worker_t * client_wrk, session_t * ll,
ss->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE,
sct->c_is_ip4);
ss->connection_index = sct->c_c_index;
- ss->listener_index = ll->session_index;
+ ss->listener_handle = listen_session_get_handle (ll);
ss->session_state = SESSION_STATE_CREATED;
server_wrk = application_listener_select_worker (ll);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 6f137e91e55..69b19909b56 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -275,7 +275,7 @@ app_worker_init_accepted (session_t * s)
segment_manager_t *sm;
session_t *listener;
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
app_wrk = application_listener_select_worker (listener);
s->app_wrk_index = app_wrk->wrk_index;
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 298d8d8bb06..4b3ce016be5 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -168,6 +168,7 @@ session_alloc (u32 thread_index)
clib_memset (s, 0, sizeof (*s));
s->session_index = s - wrk->sessions;
s->thread_index = thread_index;
+ s->app_index = APP_INVALID_INDEX;
return s;
}
@@ -877,13 +878,13 @@ session_stream_accept_notify (transport_connection_t * tc)
*/
int
session_stream_accept (transport_connection_t * tc, u32 listener_index,
- u8 notify)
+ u32 thread_index, u8 notify)
{
session_t *s;
int rv;
s = session_alloc_for_connection (tc);
- s->listener_index = listener_index;
+ s->listener_handle = ((u64) thread_index << 32) | (u64) listener_index;
s->session_state = SESSION_STATE_CREATED;
if ((rv = app_worker_init_accepted (s)))
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 4e63d42de83..d1268188962 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -367,7 +367,7 @@ void session_transport_delete_notify (transport_connection_t * tc);
void session_transport_closed_notify (transport_connection_t * tc);
void session_transport_reset_notify (transport_connection_t * tc);
int session_stream_accept (transport_connection_t * tc, u32 listener_index,
- u8 notify);
+ u32 thread_index, u8 notify);
void session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
u32 output_node);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index da62c8598b6..9e7a42d2d39 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -196,7 +196,7 @@ mq_send_session_accepted_cb (session_t * s)
if (session_has_transport (s))
{
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
mp->listener_handle = app_listen_session_handle (listener);
if (application_is_proxy (app))
{
@@ -217,7 +217,7 @@ mq_send_session_accepted_cb (session_t * s)
ct_connection_t *ct;
ct = (ct_connection_t *) session_get_transport (s);
- listener = listen_session_get (s->listener_index);
+ listener = listen_session_get_from_handle (s->listener_handle);
mp->listener_handle = app_listen_session_handle (listener);
mp->rmt.is_ip4 = session_type_is_ip4 (listener->session_type);
mp->rmt.port = ct->c_rmt_port;
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index 4a8e97ecf89..ae5d4db2296 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -167,7 +167,7 @@ typedef struct session_
union
{
/** Parent listener session index if the result of an accept */
- u32 listener_index;
+ session_handle_t listener_handle;
/** App listener index in app's listener pool if a listener */
u32 al_index;