diff options
author | Florin Coras <fcoras@cisco.com> | 2022-03-30 16:08:25 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-03-31 15:43:28 +0000 |
commit | d04ea4443ffedcb3f07bb0accfdbf2da2b8911f4 (patch) | |
tree | 5c8fc20c14fdb427e4905556e44693f3eaa3b808 /src/vcl/vppcom.c | |
parent | 8a4a7c216a7db3f06a2221290129aaba81a44bb9 (diff) |
vcl: fix api detach if attach failed
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Idd1df83bb01951c2455b23c08e3cc1fcd9b91064
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 0e81749224e..7fffc3bcbe2 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1286,6 +1286,9 @@ vcl_api_handle_disconnect (vcl_worker_t *wrk) static void vcl_api_detach (vcl_worker_t * wrk) { + if (wrk->api_client_handle == ~0) + return; + vcl_send_app_detach (wrk); if (vcm->cfg.vpp_app_socket_api) @@ -1328,7 +1331,10 @@ vppcom_app_create (const char *app_name) vcl_worker_alloc_and_init (); if ((rv = vcl_api_attach ())) - return rv; + { + vppcom_app_destroy (); + return rv; + } VDBG (0, "app_name '%s', my_client_index %d (0x%x)", app_name, vcm->workers[0].api_client_handle, vcm->workers[0].api_client_handle); @@ -1358,6 +1364,7 @@ vppcom_app_destroy (void) vcl_api_detach (current_wrk); vcl_worker_cleanup (current_wrk, 0 /* notify vpp */ ); + vcl_set_worker_index (~0); vcl_elog_stop (vcm); |