From d25fc79d72ad5fa33217cc2f1c232647d456b60c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 16 Dec 2016 12:33:47 +0100 Subject: [PATCH] CLEANUP: stats: move a misplaced stats context initialization This is a leftover from the cleanup campaign, the stats scope was still initialized by the CLI instead of being initialized by the stats keyword parsers. This should probably be backported to 1.7 to make the code more consistent. --- src/cli.c | 3 --- src/stats.c | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cli.c b/src/cli.c index 12556bc11..82c1bf759 100644 --- a/src/cli.c +++ b/src/cli.c @@ -454,9 +454,6 @@ static int cli_parse_request(struct appctx *appctx, char *line) arg++; } - appctx->ctx.stats.scope_str = 0; - appctx->ctx.stats.scope_len = 0; - appctx->ctx.stats.flags = 0; appctx->st2 = 0; kw = cli_find_kw(args); diff --git a/src/stats.c b/src/stats.c index 8ad983df6..976496e28 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3096,6 +3096,10 @@ static int cli_parse_clear_counters(char **args, struct appctx *appctx, void *pr static int cli_parse_show_info(char **args, struct appctx *appctx, void *private) { + appctx->ctx.stats.scope_str = 0; + appctx->ctx.stats.scope_len = 0; + appctx->ctx.stats.flags = 0; + if (strcmp(args[2], "typed") == 0) appctx->ctx.stats.flags |= STAT_FMT_TYPED; return 0; @@ -3104,6 +3108,10 @@ static int cli_parse_show_info(char **args, struct appctx *appctx, void *private static int cli_parse_show_stat(char **args, struct appctx *appctx, void *private) { + appctx->ctx.stats.scope_str = 0; + appctx->ctx.stats.scope_len = 0; + appctx->ctx.stats.flags = 0; + if (*args[2] && *args[3] && *args[4]) { struct proxy *px;