From 541406241231c863deb59f794890e16e5ba6ea5a Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 4 Feb 2020 19:04:34 +0000 Subject: vcl: switch to closed state after app close Type: fix Signed-off-by: Florin Coras Change-Id: I851db474538de76d5f70dd6d6f83a6487a5a02bd --- src/vcl/ldp.c | 1 + src/vcl/vcl_private.h | 2 +- src/vcl/vppcom.c | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/vcl') diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 34eba377451..d0cf2b91367 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -653,6 +653,7 @@ ldp_select_vcl_map_to_libc (clib_bitmap_t * vclb, fd_set * __restrict libcb) /* *INDENT-OFF* */ clib_bitmap_foreach (si, vclb, ({ vlsh = vls_session_index_to_vlsh (si); + ASSERT (vlsh != VLS_INVALID_HANDLE); fd = ldp_vlsh_to_fd (vlsh); if (PREDICT_FALSE (fd < 0)) { diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index fd9d73c3547..f9fa066e474 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -64,7 +64,7 @@ typedef enum typedef enum { - STATE_START = 0, + STATE_CLOSED = 0, STATE_CONNECT = 0x01, STATE_LISTEN = 0x02, STATE_ACCEPT = 0x04, diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 916ddf94f02..892d65c348c 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -60,8 +60,8 @@ vppcom_session_state_str (vcl_session_state_t state) switch (state) { - case STATE_START: - st = "STATE_START"; + case STATE_CLOSED: + st = "STATE_CLOSED"; break; case STATE_CONNECT: @@ -1220,7 +1220,7 @@ vppcom_session_create (u8 proto, u8 is_nonblocking) session = vcl_session_alloc (wrk); session->session_type = proto; - session->session_state = STATE_START; + session->session_state = STATE_CLOSED; session->vpp_handle = ~0; session->is_dgram = vcl_proto_is_dgram (proto); @@ -1309,6 +1309,8 @@ vcl_session_cleanup (vcl_worker_t * wrk, vcl_session_t * session, session->vpp_handle, 0); } + session->session_state = STATE_CLOSED; + /* Session is removed only after vpp confirms the disconnect */ return rv; -- cgit 1.2.3-korg