From: Willy Tarreau Date: Sun, 1 Dec 2013 11:32:30 +0000 (+0100) Subject: MEDIUM: stats: delay appctx initialization X-Git-Tag: v1.5-dev20~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4171e9eef020700b001570de018c9194008c55ba;p=thirdparty%2Fhaproxy.git MEDIUM: stats: delay appctx initialization Now that the session handler can automatically initialize the appctx, let's not do it in stats_accept() anymore. --- diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h index e488a5e8e7..fd345d51a7 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 1b6fe3d343..6cc2bcd911 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;