]> git.kaiwu.me - haproxy.git/commit
MINOR: proxy: add refcount to proxies
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 Feb 2026 10:29:00 +0000 (11:29 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Mar 2026 09:44:59 +0000 (10:44 +0100)
commitf3127df74d8e78aa26637c2f3cbc5a9dc9e5e56c
treeab7bcacbc0076d9122d77f65d04c4e07459c2400
parentebbdfc5915855c599cfca598c0ad24cbf9bf61c3
MINOR: proxy: add refcount to proxies

Implement refcount notion into proxy structure. The objective is to be
able to increment refcount on proxy to prevent its deletion temporarily.
This is similar to the server refcount : "del backend" is not blocked
and will remove the targetted instance from the global proxies_list.
However, the final free operation is delayed until the refcount is null.

As stated above, the API is similar to servers. Proxies are initialized
with a refcount of 1. Refcount can be incremented via proxy_take(). When
no longer useful, refcount is decremented via proxy_drop() which
replaces the older free_proxy(). Deinit is only performed once refcount
is null.

This commit also defines flag PR_FL_DELETED. It is set when a proxy
instance has been removed via a "del backend" CLI command. This should
serve as indication to modules which may still have a refcount on the
target proxy so that they can release it as soon as possible.

Note that this new refcount is completely ignored for a default proxy
instance. For them, proxy_take() is pure noop. Free is immediately
performed on first proxy_drop() invokation.
include/haproxy/proxy-t.h
include/haproxy/proxy.h
src/haproxy.c
src/hlua.c
src/http_client.c
src/log.c
src/proxy.c
src/resolvers.c
src/sink.c