diff options
author | Florin Coras <fcoras@cisco.com> | 2024-02-26 14:52:34 -0800 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-02-27 18:49:06 +0000 |
commit | 7c90be5e2963e7852754e963cc92fca0b64c3bb7 (patch) | |
tree | be108e70e66441c8d402d9dbdb6568b8820b3014 | |
parent | 4af3fdfdd0a0c2993c80eda6faef6a782111277c (diff) |
session: fix transport closed and disconnect race
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ie7ff4bac22e9dbb449610072b52d1ec4e46fe757
-rw-r--r-- | src/vnet/session/session_input.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c index 9153f07070d..b403f7ddc4c 100644 --- a/src/vnet/session/session_input.c +++ b/src/vnet/session/session_input.c @@ -162,8 +162,10 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, { if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) { - session_set_state (s, old_state); - app_worker_close_notify (app_wrk, s); + session_set_state (s, + clib_max (old_state, s->session_state)); + if (!(s->flags & SESSION_F_APP_CLOSED)) + app->cb_fns.session_disconnect_callback (s); } } break; @@ -188,8 +190,9 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, } if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) { - session_set_state (s, old_state); - app_worker_close_notify (app_wrk, s); + session_set_state (s, clib_max (old_state, s->session_state)); + if (!(s->flags & SESSION_F_APP_CLOSED)) + app->cb_fns.session_disconnect_callback (s); } break; case SESSION_CTRL_EVT_DISCONNECTED: |