CLEANUP: server: rename findserver() to server_find_by_name()

Now it's more logical and matches what is done in the rest of these
functions. server_find() now relies on it.
This commit is contained in:
Willy Tarreau 2025-07-10 11:07:51 +02:00
parent 6ad9285796
commit 61acd15ea8
7 changed files with 8 additions and 8 deletions

View File

@ -61,7 +61,7 @@ const char *srv_update_check_addr_port(struct server *s, const char *addr, const
const char *srv_update_agent_addr_port(struct server *s, const char *addr, const char *port);
struct server *server_find_by_id(struct proxy *bk, int id);
struct server *server_find_by_id_unique(struct proxy *bk, int id, uint32_t rid);
struct server *findserver(struct proxy *px, const char *name);
struct server *server_find_by_name(struct proxy *px, const char *name);
struct server *server_find(struct proxy *bk, const char *name);
struct server *server_find_unique(struct proxy *bk, const char *name, uint32_t rid);
struct server *server_find_best_match(struct proxy *bk, char *name, int id, int *diff);

View File

@ -3313,7 +3313,7 @@ int check_config_validity()
srule->dynamic = 0;
srule->srv.name = server_name;
target = findserver(curproxy, srule->srv.name);
target = server_find_by_name(curproxy, srule->srv.name);
err_code |= warnif_tcp_http_cond(curproxy, srule->cond);
if (!target) {

View File

@ -1440,7 +1440,7 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
sname = argp[idx].data.str.area;
px = p;
}
argp[idx].data.srv = findserver(px, sname);
argp[idx].data.srv = server_find_by_name(px, sname);
if (!argp[idx].data.srv) {
msg = "server doesn't exist";
goto error;

View File

@ -1498,7 +1498,7 @@ int smp_resolve_args(struct proxy *p, char **err)
sname = arg->data.str.area;
}
srv = findserver(px, sname);
srv = server_find_by_name(px, sname);
if (!srv) {
memprintf(err, "%sparsing [%s:%d]: unable to find server '%s' in proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
*err ? *err : "", cur->file, cur->line, sname, pname,

View File

@ -4006,7 +4006,7 @@ struct server *server_find_by_id_unique(struct proxy *bk, int id, uint32_t rid)
* This function returns the server with a matching name within selected proxy,
* or NULL if not found.
*/
struct server *findserver(struct proxy *px, const char *name)
struct server *server_find_by_name(struct proxy *px, const char *name)
{
struct ebpt_node *node;
struct server *cursrv;
@ -6553,7 +6553,7 @@ int srv_apply_track(struct server *srv, struct proxy *curproxy)
px = curproxy;
}
strack = findserver(px, sname);
strack = server_find_by_name(px, sname);
if (!strack) {
ha_alert("unable to find required server '%s' for tracking.\n",
sname);

View File

@ -1791,7 +1791,7 @@ static int stats_process_http_post(struct stconn *sc)
}
reprocess = 1;
}
else if ((sv = findserver(px, value)) != NULL) {
else if ((sv = server_find_by_name(px, value)) != NULL) {
HA_SPIN_LOCK(SERVER_LOCK, &sv->lock);
switch (action) {
case ST_ADM_ACTION_DISABLE:

View File

@ -1220,7 +1220,7 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi
if (!build_logline(s, tmp->area, tmp->size, &rule->expr))
break;
srv = findserver(s->be, tmp->area);
srv = server_find_by_name(s->be, tmp->area);
if (!srv)
break;
}