aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-01-02 19:31:22 -0800
committerDave Barach <openvpp@barachs.net>2019-01-05 21:53:16 +0000
commit30e79c2e388a98160a3660f4f03103890c9b1b7c (patch)
tree0b108f43d95e28304924cc6e1d43900b3046c8de /src/vcl/vcl_private.c
parent3c1cf2c1716f436e5da4a106dd2b9a3df5d3a4a3 (diff)
vcl/session: add api for changing session app worker
In case of multi process apps, after forking, the parent may decide to close part or all of the sessions it shares with the child. Because the sessions have fifos allocated in the parent's segment manager, they must be moved to the child's segment manager. Change-Id: I85b4c8c8545005724023ee14043647719cef61dd Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index d82a7ff3355..32664312f01 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -375,21 +375,23 @@ vcl_worker_share_session (vcl_worker_t * parent, vcl_worker_t * wrk,
vcl_session_t * new_s)
{
vcl_shared_session_t *ss;
- vcl_session_t *s;
+ vcl_session_t *old_s;
- s = vcl_session_get (parent, new_s->session_index);
- if (s->shared_index == ~0)
+ if (new_s->shared_index == ~0)
{
ss = vcl_shared_session_alloc ();
+ ss->session_index = new_s->session_index;
vec_add1 (ss->workers, parent->wrk_index);
- s->shared_index = ss->ss_index;
+ vec_add1 (ss->workers, wrk->wrk_index);
+ new_s->shared_index = ss->ss_index;
+ old_s = vcl_session_get (parent, new_s->session_index);
+ old_s->shared_index = ss->ss_index;
}
else
{
- ss = vcl_shared_session_get (s->shared_index);
+ ss = vcl_shared_session_get (new_s->shared_index);
+ vec_add1 (ss->workers, wrk->wrk_index);
}
- new_s->shared_index = ss->ss_index;
- vec_add1 (ss->workers, wrk->wrk_index);
}
int
@@ -414,6 +416,12 @@ vcl_worker_unshare_session (vcl_worker_t * wrk, vcl_session_t * s)
return 1;
}
+ /* If the first removed and not last, start session worker change.
+ * First request goes to vpp and vpp reflects it back to the right
+ * worker */
+ if (i == 0)
+ vcl_send_session_worker_update (wrk, s, ss->workers[0]);
+
return 0;
}