]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2: add counters instance to h2c
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 27 Oct 2020 16:16:01 +0000 (17:16 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Oct 2020 07:55:11 +0000 (08:55 +0100)
Add pointer to counters as a member for h2c structure. This pointer is
initialized on h2_init function. This is useful to quickly access and
manipulate the counters inside every h2 functions.

src/mux_h2.c

index 0d45c54e586eb973498a7b9d42dc2ca9c4ff5ded..7d9a7ae3dd3ca47bcb5e389e17104f7960aed109 100644 (file)
@@ -129,6 +129,7 @@ struct h2c {
        unsigned int stream_cnt;  /* total number of streams seen */
        struct proxy *proxy; /* the proxy this connection was created for */
        struct task *task;  /* timeout management task */
+       struct h2_counters *px_counters; /* h2 counters attached to proxy */
        struct eb_root streams_by_id; /* all active streams by their ID */
        struct list send_list; /* list of blocked streams requesting to send */
        struct list fctl_list; /* list of streams blocked by connection's fctl */
@@ -838,11 +839,17 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s
                h2c->shut_timeout = h2c->timeout = prx->timeout.server;
                if (tick_isset(prx->timeout.serverfin))
                        h2c->shut_timeout = prx->timeout.serverfin;
+
+               h2c->px_counters = EXTRA_COUNTERS_GET(prx->extra_counters_be,
+                                                     &h2_stats_module);
        } else {
                h2c->flags = H2_CF_NONE;
                h2c->shut_timeout = h2c->timeout = prx->timeout.client;
                if (tick_isset(prx->timeout.clientfin))
                        h2c->shut_timeout = prx->timeout.clientfin;
+
+               h2c->px_counters = EXTRA_COUNTERS_GET(prx->extra_counters_fe,
+                                                     &h2_stats_module);
        }
 
        h2c->proxy = prx;