From: Willy Tarreau Date: Sat, 23 Aug 2025 17:26:54 +0000 (+0200) Subject: CLEANUP: server: use server_find_by_id() when looking for already used IDs X-Git-Tag: v3.3-dev9~101 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ed4cdbf3d08cec3725d7d1d96a2b235ab10d00d;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/server.c b/src/server.c index a5dc0ff5c..a473b56a5 100644 --- a/src/server.c +++ b/src/server.c @@ -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);