aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/session/application.c2
-rw-r--r--src/vnet/session/application.h1
-rw-r--r--src/vnet/session/session_api.c8
3 files changed, 5 insertions, 6 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 7fe81885725..d3e598ca271 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1061,6 +1061,8 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a)
return VNET_API_ERROR_INVALID_VALUE;
application_api_table_del (app_wrk->api_client_index);
+ if (appns_sapi_enabled ())
+ sapi_socket_close_w_handle (app_wrk->api_client_index);
app_worker_free (app_wrk);
app_worker_map_free (app, wrk_map);
if (application_n_workers (app) == 0)
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 5ddf1d21fe3..6afbaa3eef0 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -364,6 +364,7 @@ int mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
session_t * s, session_error_t err);
void mq_send_unlisten_reply (app_worker_t * app_wrk, session_handle_t sh,
u32 context, int rv);
+void sapi_socket_close_w_handle (u32 api_handle);
crypto_engine_type_t app_crypto_engine_type_add (void);
u8 app_crypto_engine_n_types (void);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index e420099e308..e6aac953bce 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -1385,7 +1385,7 @@ done:
vec_free (fds);
}
-static void
+void
sapi_socket_close_w_handle (u32 api_handle)
{
app_namespace_t *app_ns = app_namespace_get (api_handle >> 16);
@@ -1443,10 +1443,7 @@ sapi_add_del_worker_handler (app_namespace_t * app_ns,
}
if (!mp->is_add)
- {
- sapi_socket_close_w_handle (sapi_handle);
- goto done;
- }
+ goto done;
/* Send fifo segment fd if needed */
if (ssvm_type (args.segment) == SSVM_SEGMENT_MEMFD)
@@ -1573,7 +1570,6 @@ sapi_socket_detach (app_namespace_t * app_ns, clib_socket_t * cs)
u32 api_client_handle;
api_client_handle = appns_sapi_socket_handle (app_ns, cs);
- sapi_socket_close_w_handle (api_client_handle);
/* Cleanup everything because app worker closed socket or crashed */
handle = (app_ns_api_handle_t *) & cs->private_data;