aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-11-30 12:11:20 -0800
committerDave Barach <openvpp@barachs.net>2018-12-03 16:23:55 +0000
commit940f78fcf4e276cadef3f163d0493b74fc49755c (patch)
treec508300f67e1da4bb03bcd58bf2e1ff5eb62c087 /src/vcl/vcl_private.c
parentadc74d7b3da5a48cd346ce14694415e7c5c307bb (diff)
vcl: handle worker process exit
Change-Id: Ife05d25fd736ae3064f01e974e5aecc5b48de924 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 76ae0e7719f..673b91d4576 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -221,13 +221,15 @@ vcl_worker_free (vcl_worker_t * wrk)
}
void
-vcl_worker_cleanup (void)
+vcl_worker_cleanup (u8 notify_vpp)
{
vcl_worker_t *wrk = vcl_worker_get_current ();
clib_spinlock_lock (&vcm->workers_lock);
- vcl_send_app_worker_add_del (0 /* is_add */ );
- close (wrk->mqs_epfd);
+ if (notify_vpp)
+ vcl_send_app_worker_add_del (0 /* is_add */ );
+ if (wrk->mqs_epfd > 0)
+ close (wrk->mqs_epfd);
hash_free (wrk->session_index_by_vpp_handles);
hash_free (wrk->ct_registration_by_mq);
clib_spinlock_free (&wrk->ct_registration_lock);
@@ -236,13 +238,14 @@ vcl_worker_cleanup (void)
vcl_set_worker_index (~0);
vcl_worker_free (wrk);
clib_spinlock_unlock (&vcm->workers_lock);
- VDBG (0, "cleaned up worker %u", wrk->wrk_index);
}
static void
vcl_worker_cleanup_cb (void *arg)
{
- vcl_worker_cleanup ();
+ u32 wrk_index = vcl_get_worker_index ();
+ vcl_worker_cleanup (1 /* notify vpp */ );
+ VDBG (0, "cleaned up worker %u", wrk_index);
}
vcl_worker_t *