]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] make the unix stats sockets use the generic session handler
authorWilly Tarreau <w@1wt.eu>
Sun, 16 Aug 2009 16:51:29 +0000 (18:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 16 Aug 2009 17:33:51 +0000 (19:33 +0200)
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
src/dumpstats.c
src/proto_uxst.c
src/session.c

index bf487b6a91e2009b81326c283a64388caa36e442..075ca2e3c51a4357f474f646550d5531c0e85094 100644 (file)
@@ -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 */
 
index 0615366824778825c0796e18beaa52a229d0341f..2683b52988d39de8be24ecfb0ac2b4e0394431e9 100644 (file)
@@ -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 */
 
index 742d1160b22aa356e3e1106ff37baca685669d9a..44e7c3c25e4a084ca9511def1b355449bb6e1878 100644 (file)
@@ -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:
index 5197a80f751cf392ee744ec667837e0d2f643ed4..56bf102e376722c2ecf1de51e95f18d5d5cf1cfa 100644 (file)
@@ -28,6 +28,7 @@
 #include <proto/pipe.h>
 #include <proto/proto_http.h>
 #include <proto/proto_tcp.h>
+#include <proto/proto_uxst.h>
 #include <proto/proxy.h>
 #include <proto/queue.h>
 #include <proto/server.h>
@@ -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))