aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_cfg.c2
-rw-r--r--src/vcl/vcl_private.h1
-rw-r--r--src/vcl/vppcom.c39
3 files changed, 21 insertions, 21 deletions
diff --git a/src/vcl/vcl_cfg.c b/src/vcl/vcl_cfg.c
index 2e180f4be9a..2ae940170b7 100644
--- a/src/vcl/vcl_cfg.c
+++ b/src/vcl/vcl_cfg.c
@@ -19,7 +19,7 @@
* Do not access it directly -- use vcm which will point to
* the heap allocated copy after init.
*/
-static vppcom_main_t _vppcom_main = {
+vppcom_main_t _vppcom_main = {
.debug = VPPCOM_DEBUG_INIT,
.is_init = 0,
.app_index = ~0,
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 12af09fbf55..c4ec02e8306 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -360,6 +360,7 @@ typedef struct vppcom_main_t_
} vppcom_main_t;
extern vppcom_main_t *vcm;
+extern vppcom_main_t _vppcom_main;
#define VCL_INVALID_SESSION_INDEX ((u32)~0)
#define VCL_INVALID_SESSION_HANDLE ((u64)~0)
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