aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-11-27 10:30:03 -0800
committerDave Barach <openvpp@barachs.net>2021-11-29 17:50:16 +0000
commit1a4aaf1c31682650f21a13d0ca2805f916bd010d (patch)
tree45e16339c4376fdea911eb39c862043fce15205b /src
parent5babf98369e07847806752c09f4dac81f270765e (diff)
session: mark first listener segment as protected
Avoid constantly re-mapping a listener's first segment when all its sessions are closed. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iea7033fb70f4cf9e4408d542b7c0ff2b0c5c2f92
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/application_worker.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index be8a9e86bd5..54377604803 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -184,6 +184,9 @@ app_worker_init_listener (app_worker_t * app_wrk, session_t * ls)
if (!(sm = app_worker_alloc_segment_manager (app_wrk)))
return SESSION_E_ALLOC;
+ /* Once the first segment is mapped, don't remove it until unlisten */
+ sm->first_is_protected = 1;
+
/* Keep track of the segment manager for the listener or this worker */
hash_set (app_wrk->listeners_table, listen_session_get_handle (ls),
segment_manager_index (sm));
@@ -274,6 +277,7 @@ app_worker_stop_listen_session (app_worker_t * app_wrk, session_t * ls)
sm = segment_manager_get (*sm_indexp);
if (sm)
{
+ sm->first_is_protected = 0;
segment_manager_app_detach (sm);
if (!segment_manager_has_fifos (sm))
{