aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/sapi/vpp_echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo.c')
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c
index 816b7d41c77..d78bd12f96c 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo.c
@@ -256,6 +256,30 @@ echo_update_count_on_session_close (echo_main_t * em, echo_session_t * s)
}
static void
+echo_session_detach_fifos (echo_session_t *s)
+{
+ echo_main_t *em = &echo_main;
+ fifo_segment_t *fs;
+
+ if (!s->rx_fifo)
+ return;
+
+ clib_spinlock_lock (&em->segment_handles_lock);
+
+ fs = fifo_segment_get_segment_if_valid (&em->segment_main,
+ s->rx_fifo->segment_index);
+
+ if (!fs)
+ goto done;
+
+ fifo_segment_free_client_fifo (fs, s->rx_fifo);
+ fifo_segment_free_client_fifo (fs, s->tx_fifo);
+
+done:
+ clib_spinlock_unlock (&em->segment_handles_lock);
+}
+
+static void
echo_free_sessions (echo_main_t * em)
{
/* Free marked sessions */
@@ -273,6 +297,7 @@ echo_free_sessions (echo_main_t * em)
{
/* Free session */
s = pool_elt_at_index (em->sessions, *session_index);
+ echo_session_detach_fifos (s);
echo_session_handle_add_del (em, s->vpp_session_handle,
SESSION_INVALID_INDEX);
clib_memset (s, 0xfe, sizeof (*s));