mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 12:22:45 +02:00
MEDIUM: server: extend refcount for all servers
In a future patch, it will be possible to remove at runtime every servers, both static and dynamic. This requires to extend the server refcount for all instances. First, refcount manipulation functions have been renamed to better express the API usage. * srv_refcount_use -> srv_take The refcount is always initialize to 1 on the server creation in new_server. It's also incremented for each check/agent configured on a server instance. * free_server -> srv_drop This decrements the refcount and if null, the server is freed, so code calling it must not use the server reference after it. As a bonus, this function now returns the next server instance. This is useful when calling on the server loop without having to save the next pointer before each invocation. In these functions, remove the checks that prevent refcount on non-dynamic servers. Each reference to "dynamic" in variable/function naming have been eliminated as well.
This commit is contained in:
@@ -59,8 +59,8 @@ int srv_set_addr_via_libc(struct server *srv, int *err_code);
|
||||
int srv_init_addr(void);
|
||||
struct server *cli_find_server(struct appctx *appctx, char *arg);
|
||||
struct server *new_server(struct proxy *proxy);
|
||||
void srv_use_dynsrv(struct server *srv);
|
||||
struct server *free_server(struct server *srv);
|
||||
void srv_take(struct server *srv);
|
||||
struct server *srv_drop(struct server *srv);
|
||||
int srv_init_per_thr(struct server *srv);
|
||||
|
||||
/* functions related to server name resolution */
|
||||
|
||||
Reference in New Issue
Block a user