diff options
author | Florin Coras <fcoras@cisco.com> | 2023-10-09 18:25:39 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-10-10 23:49:41 +0000 |
commit | 471dc6b1e3ea53ed48d0727070c02fc9cc9da423 (patch) | |
tree | 5dbfaff83629f84a155cb990cf3940372d2d0b0a /src | |
parent | 1ec3a70f665ec4080e2c1ffa1dc436a04b1a18c7 (diff) |
session: maintain old state on premature close
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I2ea821e0499a3874c4579f5480ea86f30ebe615f
(cherry picked from commit 84c9ee3d696ef5c1162530a30ba591b806a7e175)
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/session/session_input.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c index 404ee8b2d82..efc4f542007 100644 --- a/src/vnet/session/session_input.c +++ b/src/vnet/session/session_input.c @@ -77,7 +77,8 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, { application_t *app = application_get (app_wrk->app_index); svm_msg_q_t *mq = app_wrk->event_queue; - u8 ring_index, mq_is_cong, was_closed; + u8 ring_index, mq_is_cong; + session_state_t old_state; session_event_t *evt; u32 n_evts = 128, i; session_t *s; @@ -148,7 +149,7 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, break; case SESSION_CTRL_EVT_ACCEPTED: s = session_get (evt->session_index, thread_index); - was_closed = s->session_state >= SESSION_STATE_TRANSPORT_CLOSING; + old_state = s->session_state; if (app->cb_fns.session_accept_callback (s)) { session_close (s); @@ -162,15 +163,18 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, s->flags &= ~SESSION_F_RX_EVT; app->cb_fns.builtin_app_rx_callback (s); } - if (was_closed) - app_worker_close_notify (app_wrk, s); + if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) + { + session_set_state (s, old_state); + app_worker_close_notify (app_wrk, s); + } } break; case SESSION_CTRL_EVT_CONNECTED: if (!(evt->as_u64[1] & 0xffffffff)) { s = session_get (evt->session_index, thread_index); - was_closed = s->session_state >= SESSION_STATE_TRANSPORT_CLOSING; + old_state = s->session_state; } else s = 0; @@ -185,13 +189,16 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index, s->app_wrk_index = SESSION_INVALID_INDEX; break; } - if (was_closed) - app_worker_close_notify (app_wrk, s); if (s->flags & SESSION_F_RX_EVT) { s->flags &= ~SESSION_F_RX_EVT; app->cb_fns.builtin_app_rx_callback (s); } + if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) + { + session_set_state (s, old_state); + app_worker_close_notify (app_wrk, s); + } break; case SESSION_CTRL_EVT_DISCONNECTED: s = session_get (evt->session_index, thread_index); |