]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stats: delay appctx initialization
authorWilly Tarreau <w@1wt.eu>
Sun, 1 Dec 2013 11:32:30 +0000 (12:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:23 +0000 (15:40 +0100)
Now that the session handler can automatically initialize the appctx,
let's not do it in stats_accept() anymore.

include/proto/dumpstats.h
src/dumpstats.c

index e488a5e8e76fb881e9ed710014ff34989968b57d..fd345d51a70c67a223534ee86d98449baf48a5f0 100644 (file)
@@ -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 */
index 1b6fe3d343a4d9ca3ccc56af964675a23bddc88b..6cc2bcd911553f79f06b0c3fee10c4669346a552 100644 (file)
@@ -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;