summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_interface.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-11-20 11:31:26 -0800
committerDamjan Marion <dmarion@me.com>2018-11-21 09:05:45 +0000
commitc1f5a4336036e3f2d1f6746f39ce610312254272 (patch)
tree297539f8c961c071fe2450fa17859579e07eb7d3 /src/vnet/session/application_interface.c
parente9cebdf4c12adf7962ab2a2053789c93d70c33d3 (diff)
session: cleanup use of api_client_index
Change-Id: I8a680be62ab91d2ccb144641981a635506973a49 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_interface.c')
-rw-r--r--src/vnet/session/application_interface.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 3cd8c2f5eb3..2a09909dbef 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -496,11 +496,21 @@ vnet_application_attach (vnet_app_attach_args_t * a)
app_worker_t *app_wrk;
segment_manager_t *sm;
u32 app_ns_index = 0;
+ u8 *app_name = 0;
u64 secret;
int rv;
if (a->api_client_index != APP_INVALID_INDEX)
- app = application_lookup (a->api_client_index);
+ {
+ app = application_lookup (a->api_client_index);
+ if (!app)
+ {
+ vl_api_registration_t *regp;
+ regp = vl_api_client_index_to_registration (a->api_client_index);
+ app_name = format (0, "%s%c", regp->name, 0);
+ a->name = app_name;
+ }
+ }
else if (a->name)
app = application_lookup_name (a->name);
else
@@ -524,6 +534,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
return clib_error_return_code (0, rv, 0, "app default wrk init: %d", rv);
a->app_evt_q = app_wrk->event_queue;
+ app_wrk->api_client_index = a->api_client_index;
sm = segment_manager_get (app_wrk->first_segment_manager);
fs = segment_manager_get_segment_w_lock (sm, 0);
@@ -534,7 +545,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
a->segment = &fs->ssvm;
segment_manager_segment_reader_unlock (sm);
-
+ vec_free (app_name);
return 0;
}