diff options
author | 2020-04-16 18:47:27 +0000 | |
---|---|---|
committer | 2020-08-13 17:20:47 +0000 | |
commit | 8f8c625f2155b9151a6727235a50466add358397 (patch) | |
tree | 67089fddeb0d0bdf728ef507ebd95758d5c2bb4e /src/vcl/vppcom.c | |
parent | 5854884d5462bdb440c32969eb7aa2c0ed0ad467 (diff) |
vcl: fix app destroy
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I21daa87b1a301142270a1bf20680dd9e9395aac9
(cherry picked from commit ce815deb72fd3941b000aecec931131afc9d6c34)
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 49394e4f69c..0925246f8a1 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1090,35 +1090,34 @@ vppcom_app_create (char *app_name) void vppcom_app_destroy (void) { - int rv; - f64 orig_app_timeout; + struct dlmallinfo mi; + vcl_worker_t *wrk; + mspace heap; if (!pool_elts (vcm->workers)) return; vcl_evt (VCL_EVT_DETACH, vcm); - if (pool_elts (vcm->workers) == 1) - { - vcl_send_app_detach (vcl_worker_get_current ()); - orig_app_timeout = vcm->cfg.app_timeout; - vcm->cfg.app_timeout = 2.0; - rv = vcl_wait_for_app_state_change (STATE_APP_ENABLED); - vcm->cfg.app_timeout = orig_app_timeout; - if (PREDICT_FALSE (rv)) - VDBG (0, "application detach timed out! returning %d (%s)", rv, - vppcom_retval_str (rv)); - vec_free (vcm->app_name); - vcl_worker_cleanup (vcl_worker_get_current (), 0 /* notify vpp */ ); - } - else - { - vcl_worker_cleanup (vcl_worker_get_current (), 1 /* notify vpp */ ); - } + vcl_send_app_detach (vcl_worker_get_current ()); + + /* *INDENT-OFF* */ + pool_foreach (wrk, vcm->workers, ({ + vcl_worker_cleanup (wrk, 0 /* notify vpp */ ); + })); + /* *INDENT-ON* */ - vcl_set_worker_index (~0); vcl_elog_stop (vcm); vl_client_disconnect_from_vlib (); + + /* + * Free the heap and fix vcm + */ + heap = clib_mem_get_heap (); + mi = mspace_mallinfo (heap); + munmap (mspace_least_addr (heap), mi.arena); + + vcm = &_vppcom_main; } int |