From 4171e9eef020700b001570de018c9194008c55ba Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 1 Dec 2013 12:32:30 +0100 Subject: [PATCH] MEDIUM: stats: delay appctx initialization Now that the session handler can automatically initialize the appctx, let's not do it in stats_accept() anymore. --- include/proto/dumpstats.h | 2 +- src/dumpstats.c | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h index e488a5e8e..fd345d51a 100644 --- a/include/proto/dumpstats.h +++ b/include/proto/dumpstats.h @@ -39,7 +39,7 @@ #define STATS_TYPE_SO 3 /* unix stats socket states */ -#define STAT_CLI_INIT 0 /* initial state */ +#define STAT_CLI_INIT 0 /* initial state, must leave to zero ! */ #define STAT_CLI_END 1 /* final state, let's close */ #define STAT_CLI_GETREQ 2 /* wait for a request */ #define STAT_CLI_OUTPUT 3 /* all states after this one are responses */ diff --git a/src/dumpstats.c b/src/dumpstats.c index 1b6fe3d34..6cc2bcd91 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -156,14 +156,8 @@ extern const char *stat_status_codes[]; */ static int stats_accept(struct session *s) { - struct appctx *appctx; - s->target = &cli_applet.obj_type; - appctx = stream_int_register_handler(&s->si[1], objt_applet(s->target)); - if (!appctx) - return -1; - appctx->st1 = 0; - appctx->st0 = STAT_CLI_INIT; + /* no need to initialize the applet, it will start with st0=st1 = 0 */ tv_zero(&s->logs.tv_request); s->logs.t_queue = 0; -- 2.47.3