Skip to content

Commit

Permalink
hsa: detach app on unsuccessful listen
Browse files Browse the repository at this point in the history
Type: fix

Signed-off-by: Filip Tehlar <[email protected]>
Change-Id: Idba74f880a251dbeec2205ee41e16b40d4799b06
  • Loading branch information
ftehlar authored and florincoras committed May 16, 2023
1 parent 7ff7274 commit 4810e5b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/plugins/hs_apps/http_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -572,6 +583,7 @@ hcs_create (vlib_main_t *vm)
}
if (hcs_listen ())
{
hcs_detach ();
clib_warning ("failed to start listening");
return -1;
}
Expand Down

0 comments on commit 4810e5b

Please sign in to comment.