summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-01-23 09:21:30 -0800
committerDave Barach <openvpp@barachs.net>2019-01-24 21:23:42 +0000
commit5f45e01f5c3ce239eccd9546e2d04fa3141ca5cb (patch)
treee0dbd1254a4e7c325dca5f2738845a9b1aaedcc4 /src/vnet/session/application.c
parent8704097b9bd1e2ca717116fa1e7d61b4736c3fbd (diff)
session/vcl: support worker ownership change for listeners
Change-Id: I2ad54b20b96f10b009c3e651b2a2f885577ca5b6 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r--src/vnet/session/application.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 85b5f939427..044ab293c7e 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -730,6 +730,35 @@ app_worker_own_session (app_worker_t * app_wrk, stream_session_t * s)
segment_manager_t *sm;
svm_fifo_t *rxf, *txf;
+ if (s->session_state == SESSION_STATE_LISTENING)
+ {
+ app_worker_t *old_wrk = app_worker_get (s->app_wrk_index);
+ u64 lsh = listen_session_get_handle (s);
+ app_listener_t *app_listener;
+ application_t *app;
+
+ if (!old_wrk)
+ return -1;
+
+ hash_unset (old_wrk->listeners_table, lsh);
+ if (!(sm = app_worker_alloc_segment_manager (app_wrk)))
+ return -1;
+
+ hash_set (app_wrk->listeners_table, lsh, segment_manager_index (sm));
+ s->app_wrk_index = app_wrk->wrk_index;
+
+ app = application_get (old_wrk->app_index);
+ if (!app)
+ return -1;
+
+ app_listener = app_listener_get (app, s->listener_db_index);
+ app_listener->workers = clib_bitmap_set (app_listener->workers,
+ app_wrk->wrk_map_index, 1);
+ app_listener->workers = clib_bitmap_set (app_listener->workers,
+ old_wrk->wrk_map_index, 0);
+ return 0;
+ }
+
s->app_wrk_index = app_wrk->wrk_index;
rxf = s->server_rx_fifo;