From 3af9d832e8b6848ce538f52b317d0d14ca9dc09e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 16 Dec 2016 12:58:09 +0100 Subject: [PATCH] MINOR: appctx/cli: remove the cli_socket entry from the appctx union This one now migrates to the general purpose cli.p0. --- include/types/applet.h | 1 - src/cli.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/types/applet.h b/include/types/applet.h index 672f9db28..62537a826 100644 --- a/include/types/applet.h +++ b/include/types/applet.h @@ -168,7 +168,6 @@ struct appctx { struct { char **var; } env; - struct list *cli_socket; /* pointer to the latest dumped CLI socket in the list */ /* NOTE: please add regular applet contexts (ie: not * CLI-specific ones) above, before "cli". */ diff --git a/src/cli.c b/src/cli.c index adb2dd604..c84d72f4b 100644 --- a/src/cli.c +++ b/src/cli.c @@ -729,7 +729,8 @@ static int cli_io_handler_show_env(struct appctx *appctx) } /* - * CLI IO handler for `show cli sockets` + * CLI IO handler for `show cli sockets`. + * Uses ctx.cli.p0 to store the restart pointer. */ static int cli_io_handler_show_cli_sock(struct appctx *appctx) { @@ -745,7 +746,6 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) si_applet_cant_put(si); return 0; } - appctx->ctx.cli_socket = NULL; appctx->st2 = STAT_ST_LIST; case STAT_ST_LIST: @@ -754,15 +754,14 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) struct listener *l; /* - * get the latest dumped node in appctx->ctx.cli_socket + * get the latest dumped node in appctx->ctx.cli.p0 * if the current node is the first of the list */ - if (appctx->ctx.cli_socket && - &bind_conf->by_fe == (&global.stats_fe->conf.bind)->n - ) { + if (appctx->ctx.cli.p0 && + &bind_conf->by_fe == (&global.stats_fe->conf.bind)->n) { /* change the current node to the latest dumped and continue the loop */ - bind_conf = LIST_ELEM(appctx->ctx.cli_socket, typeof(bind_conf), by_fe); + bind_conf = LIST_ELEM(appctx->ctx.cli.p0, typeof(bind_conf), by_fe); continue; } @@ -815,7 +814,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) return 0; } } - appctx->ctx.cli_socket = &bind_conf->by_fe; /* store the latest list node dumped */ + appctx->ctx.cli.p0 = &bind_conf->by_fe; /* store the latest list node dumped */ } } default: