mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-05 04:56:10 +02:00
CLEANUP: server: use server_find_by_id() when looking for already used IDs
In srv_parse_id(), there's no point doing all the low-level work with the tree functions to check for the existence of an ID, we already have server_find_by_id() which does exactly this, so let's use it.
This commit is contained in:
parent
0b0aefe19b
commit
4ed4cdbf3d
@ -1302,7 +1302,7 @@ static int srv_parse_pool_max_conn(char **args, int *cur_arg, struct proxy *curp
|
||||
/* parse the "id" server keyword */
|
||||
static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struct server *newsrv, char **err)
|
||||
{
|
||||
struct eb32_node *node;
|
||||
struct server *target;
|
||||
|
||||
if (!*args[*cur_arg + 1]) {
|
||||
memprintf(err, "'%s' : expects an integer argument", args[*cur_arg]);
|
||||
@ -1317,9 +1317,8 @@ static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struc
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
node = eb32_lookup(&curproxy->conf.used_server_id, newsrv->puid);
|
||||
if (node) {
|
||||
struct server *target = container_of(node, struct server, conf.id);
|
||||
target = server_find_by_id(curproxy, newsrv->puid);
|
||||
if (target) {
|
||||
memprintf(err, "'%s' : custom id %d already used at %s:%d ('server %s')",
|
||||
args[*cur_arg], newsrv->puid, target->conf.file, target->conf.line,
|
||||
target->id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user