summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-08-03 18:55:40 -0700
committerFlorin Coras <florin.coras@gmail.com>2020-10-20 17:52:47 +0000
commit0ff7eec2f5b4a1b161399a209bf04d61b0ac165b (patch)
treef537c86e4c6870fc356a5801b233d8e4ca75998a /src
parentac422d6430060c003f70191c9a12466c29dab7e7 (diff)
vcl: confirm reset on transport cleanup
Type: fix Change-Id: Ife579f305409bf987639634213008a7d7f35acd7 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vppcom.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index dd50df153bb..947bf287e2d 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -784,9 +784,22 @@ vcl_session_cleanup_handler (vcl_worker_t * wrk, void *data)
/* Transport was cleaned up before we confirmed close. Probably the
* app is still waiting for some data that cannot be delivered.
* Confirm close to make sure everything is cleaned up */
- if (session->session_state == VCL_STATE_VPP_CLOSING)
- vcl_session_cleanup (wrk, session, vcl_session_handle (session),
- 1 /* do_disconnect */ );
+ if (session->session_state == VCL_STATE_VPP_CLOSING
+ || session->session_state == VCL_STATE_DISCONNECT)
+ {
+ vcl_session_cleanup (wrk, session, vcl_session_handle (session),
+ 1 /* do_disconnect */ );
+ /* Move to undetermined state to ensure that the session is not
+ * removed before both vpp and the app cleanup.
+ * - If the app closes first, the session is moved to CLOSED state
+ * and the session cleanup notification from vpp removes the
+ * session.
+ * - If vpp cleans up the session first, the session is moved to
+ * DETACHED state lower and subsequently the close from the app
+ * frees the session
+ */
+ session->session_state = VCL_STATE_UPDATED;
+ }
return;
}