summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-15 07:14:27 -0800
committerOle Trøan <otroan@employees.org>2018-11-16 07:28:35 +0000
commita7dcae72cf4520df64dd75427541ca3c11cd8475 (patch)
tree8d6f2c7c720a4569193540d6d63e870823bb6b64
parentdd4b2bb39491cb8fbfb5db8a4b9ffc3b80beba48 (diff)
VPP-1496 Cleanup stats socket on exit.
Stats socket not cleaned up on exit. vagrant@vpp:/tmp/vpp-failed-unittests/vpp-unittest-VCLCutThruTestCase-clRggF-FAILED$ ls -ltr total 104 srwxrwxr-x 1 vagrant vagrant 0 Nov 14 18:21 stats.sock Change-Id: I8126e70da2983222ca430aa280f3b9e45eea7ca4 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--src/vpp/stats/stat_segment.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index 7ae1316736d..3c5d4ebf2f4 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -573,6 +573,19 @@ stats_segment_socket_init (void)
sm->socket = s;
}
+static clib_error_t *
+stats_segment_socket_exit (vlib_main_t * vm)
+{
+ /*
+ * cleanup the listener socket on exit.
+ */
+ stat_segment_main_t *sm = &stat_segment_main;
+ unlink ((char *) sm->socket_name);
+ return 0;
+}
+
+VLIB_MAIN_LOOP_EXIT_FUNCTION (stats_segment_socket_exit);
+
static uword
stat_segment_collector_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
@@ -611,6 +624,9 @@ statseg_config (vlib_main_t * vm, unformat_input_t * input)
{
stat_segment_main_t *sm = &stat_segment_main;
+ /* set default socket file name when statseg config stanza is empty. */
+ sm->socket_name = format (0, "%s", STAT_SEGMENT_SOCKET_FILE);
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "socket-name %s", &sm->socket_name))