- if ((rv = vnet_bind_i (a->api_client_index, &ip46, port_host_order, sst,
- a->options, a->session_cb_vft, &server,
- &a->segment_name_length, a->segment_name)))
- return rv;
+ secret = a->options[APP_OPTIONS_NAMESPACE_SECRET];
+ if ((rv = session_validate_namespace (a->namespace_id, secret,
+ &app_ns_index)))
+ return clib_error_return_code (0, rv, 0, "namespace validation: %d", rv);
+ a->options[APP_OPTIONS_NAMESPACE] = app_ns_index;
+ app = application_new ();
+ if ((rv = application_init (app, a->api_client_index, a->options,
+ a->session_cb_vft)))
+ return clib_error_return_code (0, rv, 0, "app init: %d", rv);
+
+ a->app_event_queue_address = pointer_to_uword (app->event_queue);
+ sm = segment_manager_get (app->first_segment_manager);
+ fs = segment_manager_get_segment_w_lock (sm, 0);
+
+ if (application_is_proxy (app))
+ application_setup_proxy (app);
+
+ ASSERT (vec_len (fs->ssvm.name) <= 128);
+ a->segment = &fs->ssvm;
+ a->app_index = app->index;
+
+ segment_manager_segment_reader_unlock (sm);