MEDIUM: stats: delay appctx initialization

Now that the session handler can automatically initialize the appctx,
let's not do it in stats_accept() anymore.
This commit is contained in:
Willy Tarreau 2013-12-01 12:32:30 +01:00
parent 4384ddfc84
commit 4171e9eef0
2 changed files with 2 additions and 8 deletions

View File

@ -39,7 +39,7 @@
#define STATS_TYPE_SO 3 #define STATS_TYPE_SO 3
/* unix stats socket states */ /* 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_END 1 /* final state, let's close */
#define STAT_CLI_GETREQ 2 /* wait for a request */ #define STAT_CLI_GETREQ 2 /* wait for a request */
#define STAT_CLI_OUTPUT 3 /* all states after this one are responses */ #define STAT_CLI_OUTPUT 3 /* all states after this one are responses */

View File

@ -156,14 +156,8 @@ extern const char *stat_status_codes[];
*/ */
static int stats_accept(struct session *s) static int stats_accept(struct session *s)
{ {
struct appctx *appctx;
s->target = &cli_applet.obj_type; s->target = &cli_applet.obj_type;
appctx = stream_int_register_handler(&s->si[1], objt_applet(s->target)); /* no need to initialize the applet, it will start with st0=st1 = 0 */
if (!appctx)
return -1;
appctx->st1 = 0;
appctx->st0 = STAT_CLI_INIT;
tv_zero(&s->logs.tv_request); tv_zero(&s->logs.tv_request);
s->logs.t_queue = 0; s->logs.t_queue = 0;