]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: Increment the server's curr_used_conns
authorOlivier Houchard <cognet@ci0.org>
Sun, 28 Jun 2020 14:23:09 +0000 (16:23 +0200)
committerOlivier Houchard <cognet@ci0.org>
Sun, 28 Jun 2020 14:23:09 +0000 (16:23 +0200)
In tcpcheck_eval_connect(), if we're targetting a server, increase its
curr_used_conns when creating a new connection, as the counter will be
decreased later when the connection is destroyed and conn_free() is called.

src/tcpcheck.c

index 12d74518ee73859464ad5a86bbf72555e2a5b01e..4b8806c6595e7c99cb58c44c83ea0a7f0fc5c96e 100644 (file)
@@ -1026,7 +1026,11 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec
 
        /* Maybe there were an older connection we were waiting on */
        check->wait_list.events = 0;
-       conn->target = s ? &s->obj_type : &proxy->obj_type;
+       if (s) {
+               _HA_ATOMIC_ADD(&s->curr_used_conns, 1);
+               conn->target = &s->obj_type;
+       } else
+               conn->target = &proxy->obj_type;
 
        /* no client address */
        if (!sockaddr_alloc(&conn->dst)) {