From d1364402b6964cc5b2e83490bfe516e0d34becd8 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 4 Apr 2024 22:09:58 -0700 Subject: session: fix cleanup for refused sessions Type: fix Change-Id: I739b7129c7e5a3fccefcdeeaf7f4a298223dd8eb Signed-off-by: Florin Coras --- src/vnet/session/session_input.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c index 5899242f975..e7a81c343f4 100644 --- a/src/vnet/session/session_input.c +++ b/src/vnet/session/session_input.c @@ -155,7 +155,7 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, if (app->cb_fns.session_accept_callback (s)) { session_close (s); - s->app_wrk_index = SESSION_INVALID_INDEX; + s->app_wrk_index = APP_INVALID_INDEX; break; } if (is_builtin) @@ -185,7 +185,7 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, if (rv) { session_close (s); - s->app_wrk_index = SESSION_INVALID_INDEX; + s->app_wrk_index = APP_INVALID_INDEX; break; } if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) @@ -234,10 +234,11 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, case SESSION_CTRL_EVT_CLEANUP: s = session_get (evt->as_u64[0] & 0xffffffff, thread_index); /* Notification enqueued before session was refused by app */ - if (PREDICT_FALSE (s->app_wrk_index == APP_INVALID_INDEX)) - break; - if (app->cb_fns.session_cleanup_callback) - app->cb_fns.session_cleanup_callback (s, evt->as_u64[0] >> 32); + if (PREDICT_TRUE (s->app_wrk_index != APP_INVALID_INDEX)) + { + if (app->cb_fns.session_cleanup_callback) + app->cb_fns.session_cleanup_callback (s, evt->as_u64[0] >> 32); + } if (evt->as_u64[0] >> 32 != SESSION_CLEANUP_SESSION) break; uword_to_pointer (evt->as_u64[1], void (*) (session_t * s)) (s); -- cgit 1.2.3-korg