summaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-16 18:47:27 +0000
committerDave Barach <openvpp@barachs.net>2020-04-17 12:05:39 +0000
commitce815deb72fd3941b000aecec931131afc9d6c34 (patch)
tree15c9491e6b84e2d793180a25beaca4c680a77679 /src/vcl/vppcom.c
parent6f5b72ec0189377951b39a2ae2e4749951ec6730 (diff)
vcl: fix app destroy
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I21daa87b1a301142270a1bf20680dd9e9395aac9
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1591b0850a0..33e0c197186 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1211,35 +1211,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