session: segment handle in accept/connect notifications
Change-Id: I03884b6cde9d4c38ae13d1994fd8d37d44016ef0
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 380c960..69f3329 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -924,6 +924,7 @@
sm = segment_manager_get (app_wrk->first_segment_manager);
fs = segment_manager_get_segment_w_lock (sm, 0);
a->segment = &fs->ssvm;
+ a->segment_handle = segment_manager_segment_handle (sm, fs);
segment_manager_segment_reader_unlock (sm);
a->evt_q = app_wrk->event_queue;
a->wrk_map_index = app_wrk->wrk_map_index;
@@ -1007,11 +1008,12 @@
* Send an API message to the external app, to map new segment
*/
int
-app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs)
+app_worker_add_segment_notify (u32 app_wrk_index, u64 segment_handle)
{
app_worker_t *app_wrk = app_worker_get (app_wrk_index);
application_t *app = application_get (app_wrk->app_index);
- return app->cb_fns.add_segment_callback (app_wrk->api_client_index, fs);
+ return app->cb_fns.add_segment_callback (app_wrk->api_client_index,
+ segment_handle);
}
u32
@@ -1597,6 +1599,7 @@
segment_manager_t *sm;
local_session_t *ls;
svm_msg_q_t *sq, *cq;
+ u64 segment_handle;
ls = application_local_session_alloc (server_wrk);
server = application_get (server_wrk->app_index);
@@ -1660,8 +1663,9 @@
ls->listener_session_type = ll->session_type;
ls->session_state = SESSION_STATE_READY;
+ segment_handle = segment_manager_segment_handle (sm, seg);
if ((rv = server->cb_fns.add_segment_callback (server_wrk->api_client_index,
- &seg->ssvm)))
+ segment_handle)))
{
clib_warning ("failed to notify server of new segment");
segment_manager_segment_reader_unlock (sm);
@@ -1706,6 +1710,7 @@
segment_manager_t *sm;
application_t *client;
int rv, is_fail = 0;
+ u64 segment_handle;
uword client_key;
client_wrk = app_worker_get (ls->client_wrk_index);
@@ -1714,8 +1719,9 @@
sm = application_get_local_segment_manager_w_session (server_wrk, ls);
seg = segment_manager_get_segment_w_lock (sm, ls->svm_segment_index);
+ segment_handle = segment_manager_segment_handle (sm, seg);
if ((rv = client->cb_fns.add_segment_callback (client_wrk->api_client_index,
- &seg->ssvm)))
+ segment_handle)))
{
clib_warning ("failed to notify client %u of new segment",
ls->client_wrk_index);
@@ -1770,13 +1776,14 @@
if (!has_transport)
{
application_t *server = application_get (server_wrk->app_index);
+ u64 segment_handle = segment_manager_segment_handle (sm, seg);
server->cb_fns.del_segment_callback (server_wrk->api_client_index,
- &seg->ssvm);
+ segment_handle);
if (client_wrk)
{
application_t *client = application_get (client_wrk->app_index);
client->cb_fns.del_segment_callback (client_wrk->api_client_index,
- &seg->ssvm);
+ segment_handle);
}
segment_manager_del_segment (sm, seg);
}