From 104eb36f26ca73fccc4654580e86e7ad5036f978 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 16 Aug 2009 18:51:29 +0200 Subject: [PATCH] [MEDIUM] make the unix stats sockets use the generic session handler process_session() is now ready to handle unix stats sockets. This first step works and old code has not been removed. A cleanup is required. The stats handler is not unix socket-centric anymore and should move to dumpstats.c. --- include/proto/proto_uxst.h | 1 + src/dumpstats.c | 2 +- src/proto_uxst.c | 1 - src/session.c | 7 +++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/proto/proto_uxst.h b/include/proto/proto_uxst.h index bf487b6a9..075ca2e3c 100644 --- a/include/proto/proto_uxst.h +++ b/include/proto/proto_uxst.h @@ -29,6 +29,7 @@ int uxst_event_accept(int fd); void uxst_add_listener(struct listener *listener); struct task *uxst_process_session(struct task *t); +int uxst_req_analyser_stats(struct session *s, struct buffer *req, int an_bit); #endif /* _PROTO_PROTO_UXST_H */ diff --git a/src/dumpstats.c b/src/dumpstats.c index 061536682..2683b5298 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -106,7 +106,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx global.stats_sock.state = LI_INIT; global.stats_sock.options = LI_O_NONE; global.stats_sock.accept = uxst_event_accept; - global.stats_sock.handler = uxst_process_session; + global.stats_sock.handler = process_session; global.stats_sock.analysers = AN_REQ_UNIX_STATS; global.stats_sock.private = global.stats_fe; /* must point to the frontend */ diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 742d1160b..44e7c3c25 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -664,7 +664,6 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req, int an_bit) s->data_source = DATA_SRC_STATS; s->ana_state = STATS_ST_REQ; buffer_write_dis(s->req); - buffer_shutw_now(s->req); /* fall through */ case STATS_ST_REQ: diff --git a/src/session.c b/src/session.c index 5197a80f7..56bf102e3 100644 --- a/src/session.c +++ b/src/session.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -840,6 +841,12 @@ resync_stream_interface: break; } + if (s->req->analysers & AN_REQ_UNIX_STATS) { + last_ana |= AN_REQ_UNIX_STATS; + if (!uxst_req_analyser_stats(s, s->req, AN_REQ_UNIX_STATS)) + break; + } + if (s->req->analysers & AN_REQ_PRST_RDP_COOKIE) { last_ana |= AN_REQ_PRST_RDP_COOKIE; if (!tcp_persist_rdp_cookie(s, s->req, AN_REQ_PRST_RDP_COOKIE))