mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: proxy: Add a "server by name" tree to proxy.
Add a tree to proxy struct to lookup by name for servers attached to this proxy and populated it at parsing time.
This commit is contained in:
parent
db52d9087a
commit
84d6046a33
@ -447,6 +447,7 @@ struct proxy {
|
|||||||
int line; /* line where the section appears */
|
int line; /* line where the section appears */
|
||||||
struct eb_root used_listener_id;/* list of listener IDs in use */
|
struct eb_root used_listener_id;/* list of listener IDs in use */
|
||||||
struct eb_root used_server_id; /* list of server IDs in use */
|
struct eb_root used_server_id; /* list of server IDs in use */
|
||||||
|
struct eb_root used_server_name; /* list of server names in use */
|
||||||
struct list bind; /* list of bind settings */
|
struct list bind; /* list of bind settings */
|
||||||
struct list listeners; /* list of listeners belonging to this frontend */
|
struct list listeners; /* list of listeners belonging to this frontend */
|
||||||
struct arg_list args; /* sample arg list that need to be resolved */
|
struct arg_list args; /* sample arg list that need to be resolved */
|
||||||
|
@ -320,6 +320,7 @@ struct server {
|
|||||||
struct {
|
struct {
|
||||||
const char *file; /* file where the section appears */
|
const char *file; /* file where the section appears */
|
||||||
struct eb32_node id; /* place in the tree of used IDs */
|
struct eb32_node id; /* place in the tree of used IDs */
|
||||||
|
struct ebpt_node name; /* place in the tree of used names */
|
||||||
int line; /* line where the section appears */
|
int line; /* line where the section appears */
|
||||||
} conf; /* config information */
|
} conf; /* config information */
|
||||||
/* Template information used only for server objects which
|
/* Template information used only for server objects which
|
||||||
|
@ -3143,6 +3143,8 @@ int check_config_validity()
|
|||||||
next_id = get_next_id(&curproxy->conf.used_server_id, next_id);
|
next_id = get_next_id(&curproxy->conf.used_server_id, next_id);
|
||||||
newsrv->conf.id.key = newsrv->puid = next_id;
|
newsrv->conf.id.key = newsrv->puid = next_id;
|
||||||
eb32_insert(&curproxy->conf.used_server_id, &newsrv->conf.id);
|
eb32_insert(&curproxy->conf.used_server_id, &newsrv->conf.id);
|
||||||
|
newsrv->conf.name.key = newsrv->id;
|
||||||
|
ebis_insert(&curproxy->conf.used_server_name, &newsrv->conf.name);
|
||||||
}
|
}
|
||||||
next_id++;
|
next_id++;
|
||||||
newsrv = newsrv->next;
|
newsrv = newsrv->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user