diff options
author | Florin Coras <fcoras@cisco.com> | 2020-04-30 15:05:24 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-04-30 20:50:14 +0000 |
commit | bf39597d41da6d00e4d1a9954e42d16069069243 (patch) | |
tree | 17720444b6f830f21a194022d9ffa52e145e320e /src/vnet/session/application_worker.c | |
parent | 240dcb24a00004017ec2d1b23b93d9ae8d3c9f65 (diff) |
session: cleanup listener segment manager on wrk free
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1585af9e4f4273f055aed824b133ddc8eddd1df7
Diffstat (limited to 'src/vnet/session/application_worker.c')
-rw-r--r-- | src/vnet/session/application_worker.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c index 8eebaf003e6..8e3ba35013a 100644 --- a/src/vnet/session/application_worker.c +++ b/src/vnet/session/application_worker.c @@ -56,7 +56,7 @@ app_worker_free (app_worker_t * app_wrk) { application_t *app = application_get (app_wrk->app_index); vnet_unlisten_args_t _a, *a = &_a; - u64 handle, *handles = 0; + u64 handle, *handles = 0, *sm_indices = 0; segment_manager_t *sm; session_t *ls; u32 sm_index; @@ -70,22 +70,29 @@ app_worker_free (app_worker_t * app_wrk) hash_foreach (handle, sm_index, app_wrk->listeners_table, ({ ls = listen_session_get_from_handle (handle); vec_add1 (handles, app_listen_session_handle (ls)); + vec_add1 (sm_indices, sm_index); sm = segment_manager_get (sm_index); - sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX; })); /* *INDENT-ON* */ - hash_free (app_wrk->listeners_table); - for (i = 0; i < vec_len (handles); i++) { + /* Cleanup listener */ a->app_index = app->app_index; a->wrk_map_index = app_wrk->wrk_map_index; a->handle = handles[i]; - /* seg manager is removed when unbind completes */ (void) vnet_unlisten (a); + + sm = segment_manager_get_if_valid (sm_indices[i]); + if (sm && !segment_manager_app_detached (sm)) + { + sm->first_is_protected = 0; + segment_manager_init_free (sm); + } } vec_reset_length (handles); + vec_free (sm_indices); + hash_free (app_wrk->listeners_table); /* * Connects segment manager cleanup @@ -124,11 +131,11 @@ app_worker_free (app_worker_t * app_wrk) vec_free (app_wrk->half_open_table); vec_free (handles); - /* If first segment manager is used by a listener */ - if (app_wrk->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX - && app_wrk->first_segment_manager != app_wrk->connects_seg_manager) + /* If first segment manager is used by a listener that recently + * stopped listening, mark it as detached */ + if (app_wrk->first_segment_manager != app_wrk->connects_seg_manager + && (sm = segment_manager_get_if_valid (app_wrk->first_segment_manager))) { - sm = segment_manager_get (app_wrk->first_segment_manager); sm->first_is_protected = 0; sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX; /* .. and has no fifos, e.g. it might be used for redirected sessions, |