aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_worker.c
diff options
context:
space:
mode:
authorliuyacan <liuyacan@corp.netease.com>2021-04-28 11:34:03 +0000
committerFlorin Coras <florin.coras@gmail.com>2021-04-29 17:52:53 +0000
commit87d48ad8f6e8008bfd7ffaf56c91cb0c8b362330 (patch)
tree14f8706c4fecd36fd82115e0264db52cf024ad3d /src/vnet/session/application_worker.c
parent5c481ff732caef6cbd4e3c095e802f095a920d82 (diff)
session: cleanup CREATED sessions when listener goes down
We should cleanup sessions in CREATED state when listener goes down, otherwise they may use unpredictable sessions as listeners later. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: Ifbd0a0fb46275bd9d89e5aee19a70c1d01d15764
Diffstat (limited to 'src/vnet/session/application_worker.c')
-rw-r--r--src/vnet/session/application_worker.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index d44f52c5340..8c3be22d4dc 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -293,6 +293,7 @@ app_worker_stop_listen_session (app_worker_t * app_wrk, session_t * ls)
session_handle_t handle;
segment_manager_t *sm;
uword *sm_indexp;
+ session_state_t *states = 0;
handle = listen_session_get_handle (ls);
sm_indexp = hash_get (app_wrk->listeners_table, handle);
@@ -308,6 +309,13 @@ app_worker_stop_listen_session (app_worker_t * app_wrk, session_t * ls)
/* Try to cleanup segment manager */
sm = segment_manager_get (*sm_indexp);
+ if (sm && segment_manager_has_fifos (sm))
+ {
+ /* Delete sessions in CREATED state */
+ vec_add1 (states, SESSION_STATE_CREATED);
+ segment_manager_del_sessions_filter (sm, states);
+ vec_free (states);
+ }
if (sm && app_wrk->first_segment_manager != *sm_indexp)
{
segment_manager_app_detach (sm);