From 470b2a61659d76c1fc03352d42af6f3f3945330f Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Sat, 3 Aug 2019 18:53:48 -0700 Subject: vcl: fix bapi disconnect with socket transport Type:fix Change-Id: I7b69c28118f3d7054a20ca48792dfc403a8e2694 Signed-off-by: Florin Coras --- src/vcl/vcl_bapi.c | 11 +++++++++++ src/vcl/vcl_private.h | 1 + src/vcl/vppcom.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c index 2bfc7c73f92..de64809d52a 100644 --- a/src/vcl/vcl_bapi.c +++ b/src/vcl/vcl_bapi.c @@ -681,6 +681,17 @@ vppcom_connect_to_vpp (char *app_name) return VPPCOM_OK; } +void +vppcom_disconnect_from_vpp (void) +{ + vppcom_cfg_t *vcl_cfg = &vcm->cfg; + + if (vcl_cfg->vpp_api_socket_name) + vl_socket_client_disconnect (); + else + vl_client_disconnect_from_vlib (); +} + /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index 552fdd811ec..43c8ec304ef 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -598,6 +598,7 @@ void vcl_send_session_worker_update (vcl_worker_t * wrk, vcl_session_t * s, * VCL Binary API */ int vppcom_connect_to_vpp (char *app_name); +void vppcom_disconnect_from_vpp (void); void vppcom_init_error_string_table (void); void vppcom_send_session_enable_disable (u8 is_enable); void vppcom_app_send_attach (void); diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 0ee1784740a..0060922fea6 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -922,7 +922,7 @@ vppcom_app_exit (void) vcl_set_worker_index (~0); vcl_elog_stop (vcm); if (vec_len (vcm->workers) == 1) - vl_client_disconnect_from_vlib (); + vppcom_disconnect_from_vpp (); else vl_client_send_disconnect (1 /* vpp should cleanup */ ); } -- cgit 1.2.3-korg