mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 13:21:29 +02:00
MINOR: proxy: add proxy_index_id() to index a proxy by its ID
This avoids needlessly exposing the tree's root and the mechanics outside of the low-level code.
This commit is contained in:
parent
5e4b6714e1
commit
eab5b89dce
@ -22,6 +22,8 @@
|
|||||||
#ifndef _HAPROXY_PROXY_H
|
#ifndef _HAPROXY_PROXY_H
|
||||||
#define _HAPROXY_PROXY_H
|
#define _HAPROXY_PROXY_H
|
||||||
|
|
||||||
|
#include <import/eb32tree.h>
|
||||||
|
|
||||||
#include <haproxy/api.h>
|
#include <haproxy/api.h>
|
||||||
#include <haproxy/applet-t.h>
|
#include <haproxy/applet-t.h>
|
||||||
#include <haproxy/freq_ctr.h>
|
#include <haproxy/freq_ctr.h>
|
||||||
@ -120,6 +122,12 @@ static inline struct proxy *proxy_be_by_name(const char *name)
|
|||||||
return proxy_find_by_name(name, PR_CAP_BE, 0);
|
return proxy_find_by_name(name, PR_CAP_BE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* index proxy <px>'s id into used_proxy_id */
|
||||||
|
static inline void proxy_index_id(struct proxy *px)
|
||||||
|
{
|
||||||
|
eb32_insert(&used_proxy_id, &px->conf.id);
|
||||||
|
}
|
||||||
|
|
||||||
/* this function initializes all timeouts for proxy p */
|
/* this function initializes all timeouts for proxy p */
|
||||||
static inline void proxy_reset_timeouts(struct proxy *proxy)
|
static inline void proxy_reset_timeouts(struct proxy *proxy)
|
||||||
{
|
{
|
||||||
|
@ -750,7 +750,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
eb32_insert(&used_proxy_id, &curproxy->conf.id);
|
proxy_index_id(curproxy);
|
||||||
}
|
}
|
||||||
else if (strcmp(args[0], "description") == 0) {
|
else if (strcmp(args[0], "description") == 0) {
|
||||||
int i, len=0;
|
int i, len=0;
|
||||||
|
@ -2852,7 +2852,7 @@ init_proxies_list_stage1:
|
|||||||
*/
|
*/
|
||||||
next_pxid = proxy_get_next_id(next_pxid);
|
next_pxid = proxy_get_next_id(next_pxid);
|
||||||
curproxy->conf.id.key = curproxy->uuid = next_pxid;
|
curproxy->conf.id.key = curproxy->uuid = next_pxid;
|
||||||
eb32_insert(&used_proxy_id, &curproxy->conf.id);
|
proxy_index_id(curproxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curproxy->mode == PR_MODE_HTTP && global.tune.bufsize >= (256 << 20) && ONLY_ONCE()) {
|
if (curproxy->mode == PR_MODE_HTTP && global.tune.bufsize >= (256 << 20) && ONLY_ONCE()) {
|
||||||
|
@ -467,7 +467,7 @@ static struct proxy *cli_alloc_fe(const char *name, const char *file, int line)
|
|||||||
|
|
||||||
/* the stats frontend is the only one able to assign ID #0 */
|
/* the stats frontend is the only one able to assign ID #0 */
|
||||||
fe->conf.id.key = fe->uuid = 0;
|
fe->conf.id.key = fe->uuid = 0;
|
||||||
eb32_insert(&used_proxy_id, &fe->conf.id);
|
proxy_index_id(fe);
|
||||||
return fe;
|
return fe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user