]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: proxies: Update beconn separately
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 4 Mar 2026 16:43:24 +0000 (16:43 +0000)
committerOlivier Houchard <cognet@ci0.org>
Thu, 5 Mar 2026 14:39:42 +0000 (15:39 +0100)
Update beconn separately from the call to COUNTERS_UPDATE_MAX(), as soon
there will be an option to get COUNTERS_UPDATE_MAX() to do nothing, and
we still want beconn to be properly updated, as it is used for other
purposes.

src/proxy.c

index 21002b8aeda62593099ccb7d1d2faa906e5aafc6..bfef16ddda5362d0e61e03c037e2324cb36cd2dc 100644 (file)
@@ -4107,6 +4107,7 @@ end:
 int stream_set_backend(struct stream *s, struct proxy *be)
 {
        unsigned int req_ana;
+       unsigned int beconn;
 
        if (s->flags & SF_BE_ASSIGNED)
                return 1;
@@ -4120,8 +4121,8 @@ int stream_set_backend(struct stream *s, struct proxy *be)
        else
                s->be_tgcounters = NULL;
 
-       COUNTERS_UPDATE_MAX(&be->be_counters.conn_max,
-                            HA_ATOMIC_ADD_FETCH(&be->beconn, 1));
+       beconn = HA_ATOMIC_ADD_FETCH(&be->beconn, 1);
+       COUNTERS_UPDATE_MAX(&be->be_counters.conn_max, beconn);
        proxy_inc_be_ctr(be);
 
        /* assign new parameters to the stream from the new backend */