diff options
author | Florin Coras <fcoras@cisco.com> | 2021-08-12 18:12:09 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-08-30 14:26:23 +0000 |
commit | 98078ab88d93de4e44427c018cd3a74fc0ce8234 (patch) | |
tree | 80151ef6ffba300d51310aa4bb9cfe2a56cc053f /src/vnet | |
parent | 18599c5861d96723359997f2c70fc28fcac0e984 (diff) |
session: close app wrk socket on delete
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I54fa6e8f12bb52988888e7019a88d6891017944c
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/application.c | 2 | ||||
-rw-r--r-- | src/vnet/session/application.h | 1 | ||||
-rw-r--r-- | src/vnet/session/session_api.c | 8 |
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; |