mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 22:31:06 +01:00
MEDIUM: proxy: make get_backend_server() use findproxy() to lookup proxies
This one is used by stats to look up proxy and server names in server state manipulation. Get rid of the linear search.
This commit is contained in:
parent
cfd837fb6c
commit
7ecc420bbc
11
src/proxy.c
11
src/proxy.c
@ -97,22 +97,15 @@ int get_backend_server(const char *bk_name, const char *sv_name,
|
||||
{
|
||||
struct proxy *p;
|
||||
struct server *s;
|
||||
int pid, sid;
|
||||
int sid;
|
||||
|
||||
*sv = NULL;
|
||||
|
||||
pid = -1;
|
||||
if (*bk_name == '#')
|
||||
pid = atoi(bk_name + 1);
|
||||
sid = -1;
|
||||
if (*sv_name == '#')
|
||||
sid = atoi(sv_name + 1);
|
||||
|
||||
for (p = proxy; p; p = p->next)
|
||||
if ((p->cap & PR_CAP_BE) &&
|
||||
((pid >= 0 && p->uuid == pid) ||
|
||||
(pid < 0 && strcmp(p->id, bk_name) == 0)))
|
||||
break;
|
||||
p = findproxy(bk_name, PR_CAP_BE);
|
||||
if (bk)
|
||||
*bk = p;
|
||||
if (!p)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user