From 5e9ed0dc81eaf98ad27b8a45948f5751ec873f20 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 15 Aug 2023 11:16:34 -0700 Subject: vcl: handle postponed disconnects with select Type: fix Signed-off-by: Florin Coras Change-Id: Ia8449344a471129c0d148b39d97a5d310c2a1fc7 --- src/vcl/vppcom.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 6bdeb5a0db2..4b2f1f15fbe 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -2447,10 +2447,24 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); break; case SESSION_CTRL_EVT_DISCONNECTED: - disconnected_msg = (session_disconnected_msg_t *) e->data; - s = vcl_session_disconnected_handler (wrk, disconnected_msg); - if (!s) - break; + if (!e->postponed) + { + disconnected_msg = (session_disconnected_msg_t *) e->data; + s = vcl_session_disconnected_handler (wrk, disconnected_msg); + if (!s) + break; + } + else + { + s = vcl_session_get (wrk, e->session_index); + s->flags &= ~VCL_SESSION_F_PENDING_DISCONNECT; + } + if (vcl_session_is_closed (s)) + { + if (s && (s->flags & VCL_SESSION_F_PENDING_FREE)) + vcl_session_free (wrk, s); + break; + } sid = s->session_index; if (sid < n_bits && except_map) { @@ -2459,7 +2473,24 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, } break; case SESSION_CTRL_EVT_RESET: - sid = vcl_session_reset_handler (wrk, (session_reset_msg_t *) e->data); + if (!e->postponed) + { + sid = + vcl_session_reset_handler (wrk, (session_reset_msg_t *) e->data); + s = vcl_session_get (wrk, sid); + } + else + { + sid = e->session_index; + s = vcl_session_get (wrk, sid); + s->flags &= ~VCL_SESSION_F_PENDING_DISCONNECT; + } + if (vcl_session_is_closed (s)) + { + if (s && (s->flags & VCL_SESSION_F_PENDING_FREE)) + vcl_session_free (wrk, s); + break; + } if (sid < n_bits && except_map) { clib_bitmap_set_no_check ((uword *) except_map, sid, 1); -- cgit 1.2.3-korg