aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-12-12 12:01:24 -0800
committerFlorin Coras <fcoras@cisco.com>2019-12-12 12:06:16 -0800
commit64cf459bc9353935a72c3e37892b7b7444029795 (patch)
tree1dcf9fa2c4b06350de3b9f0b135515a29e748bc2 /src/vcl
parent6d5df8d22971280c8a22b0d96656f4922fe06d56 (diff)
vcl: fix disconnect from binary api
Type: fix Change-Id: I4398d26879b5efd932fa1d9ae232aa918ec736d6 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_bapi.c3
-rw-r--r--src/vcl/vcl_private.c8
-rw-r--r--src/vcl/vppcom.c4
3 files changed, 10 insertions, 5 deletions
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 194c136796a..b91e928f3e9 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -567,10 +567,11 @@ vppcom_connect_to_vpp (char *app_name)
void
vppcom_disconnect_from_vpp (void)
{
+ vcl_worker_t *wrk = vcl_worker_get_current ();
vppcom_cfg_t *vcl_cfg = &vcm->cfg;
if (vcl_cfg->vpp_api_socket_name)
- vl_socket_client_disconnect ();
+ vl_socket_client_disconnect2 (&wrk->bapi_sock_ctx);
else
vl_client_disconnect_from_vlib ();
}
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index b14fdeea454..6e887c878cd 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -158,11 +158,19 @@ vcl_worker_cleanup (vcl_worker_t * wrk, u8 notify_vpp)
clib_spinlock_lock (&vcm->workers_lock);
if (notify_vpp)
{
+ /* Notify vpp that the worker is going away */
if (wrk->wrk_index == vcl_get_worker_index ())
vcl_send_app_worker_add_del (0 /* is_add */ );
else
vcl_send_child_worker_del (wrk);
+
+ /* Disconnect the binary api */
+ if (vec_len (vcm->workers) == 1)
+ vppcom_disconnect_from_vpp ();
+ else
+ vl_client_send_disconnect (1 /* vpp should cleanup */ );
}
+
if (wrk->mqs_epfd > 0)
close (wrk->mqs_epfd);
hash_free (wrk->session_index_by_vpp_handles);
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index ce47766b5c9..d9a227d4e0a 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1015,10 +1015,6 @@ vppcom_app_exit (void)
vcl_worker_cleanup (vcl_worker_get_current (), 1 /* notify vpp */ );
vcl_set_worker_index (~0);
vcl_elog_stop (vcm);
- if (vec_len (vcm->workers) == 1)
- vppcom_disconnect_from_vpp ();
- else
- vl_client_send_disconnect (1 /* vpp should cleanup */ );
}
/*