summaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-05-16 15:32:17 +0200
committerFlorin Coras <florin.coras@gmail.com>2023-05-16 22:07:03 +0000
commit4810e5b4836e806c191ce4ffd1b5b9f6ddb349c0 (patch)
treea8ab893bf9becc2627ffa808052ed1051a293a8c /src/plugins/hs_apps
parent7ff7274c6b23f53830fb52047161bd5cb988abe2 (diff)
hsa: detach app on unsuccessful listen
Type: fix Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Idba74f880a251dbeec2205ee41e16b40d4799b06
Diffstat (limited to 'src/plugins/hs_apps')
-rw-r--r--src/plugins/hs_apps/http_cli.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/hs_apps/http_cli.c b/src/plugins/hs_apps/http_cli.c
index d742121ad2c..5d4d49c0fba 100644
--- a/src/plugins/hs_apps/http_cli.c
+++ b/src/plugins/hs_apps/http_cli.c
@@ -555,6 +555,17 @@ hcs_listen ()
return rv;
}
+static void
+hcs_detach ()
+{
+ vnet_app_detach_args_t _a, *a = &_a;
+ hcs_main_t *hcm = &hcs_main;
+ a->app_index = hcm->app_index;
+ a->api_client_index = APP_INVALID_INDEX;
+ hcm->app_index = ~0;
+ vnet_application_detach (a);
+}
+
static int
hcs_create (vlib_main_t *vm)
{
@@ -572,6 +583,7 @@ hcs_create (vlib_main_t *vm)
}
if (hcs_listen ())
{
+ hcs_detach ();
clib_warning ("failed to start listening");
return -1;
}