]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: add counters instance to h1c
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Nov 2021 16:37:51 +0000 (17:37 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Dec 2021 10:47:08 +0000 (11:47 +0100)
Add pointer to counters as a member for h1c structure. This pointer is
initialized on h1_init function. This is useful to quickly access and
manipulate the counters inside every h1 functions.

src/mux_h1.c

index f875b9609248a9619aa06c0589c8fe96ee1e1637..37ee1f1f4ea8aaa9ffe88b5c41966ca8c90e9043 100644 (file)
@@ -108,6 +108,7 @@ struct h1c {
 
        struct h1s *h1s;                 /* H1 stream descriptor */
        struct task *task;               /* timeout management task */
+       struct h1_counters *px_counters; /* h1 counters attached to proxy */
        int idle_exp;                    /* idle expiration date (http-keep-alive or http-request timeout) */
        int timeout;                     /* client/server timeout duration */
        int shut_timeout;                /* client-fin/server-fin timeout duration */
@@ -850,11 +851,17 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session
                h1c->shut_timeout = h1c->timeout = proxy->timeout.server;
                if (tick_isset(proxy->timeout.serverfin))
                        h1c->shut_timeout = proxy->timeout.serverfin;
+
+               h1c->px_counters = EXTRA_COUNTERS_GET(proxy->extra_counters_be,
+                                                     &h1_stats_module);
        } else {
                h1c->shut_timeout = h1c->timeout = proxy->timeout.client;
                if (tick_isset(proxy->timeout.clientfin))
                        h1c->shut_timeout = proxy->timeout.clientfin;
 
+               h1c->px_counters = EXTRA_COUNTERS_GET(proxy->extra_counters_fe,
+                                                     &h1_stats_module);
+
                LIST_APPEND(&mux_stopping_data[tid].list,
                            &h1c->conn->stopping_list);
        }