} timeout;
__decl_thread(HA_RWLOCK_T lock); /* may be taken under the server's lock */
- char *id, *desc; /* proxy id (name) and description */
+ char *id; /* proxy id (name), indexed by <conf.name_node> below */
+ char *desc; /* proxy description */
struct proxy_per_tgroup *per_tgrp; /* array of per-tgroup stuff such as queues */
unsigned int queueslength; /* Sum of the length of each queue */
int totpend; /* total number of pending connections on this instance (for stats) */
struct list listeners; /* list of listeners belonging to this frontend */
struct list errors; /* list of all custom error files */
struct arg_list args; /* sample arg list that need to be resolved */
- struct ebpt_node by_name; /* proxies are stored sorted by name here */
+ struct ceb_node name_node; /* proxies are stored sorted by name here; indexes <id> below */
struct list lf_checks; /* list of logformats found in the proxy section that needs to be checked during postparse */
struct log_steps log_steps; /* bitfield of log origins where log should be generated during request handling */
const char *file_prev; /* file of the previous instance found with the same name, or NULL */
#include <sys/socket.h>
#include <sys/stat.h>
+#include <import/cebis_tree.h>
#include <import/eb32tree.h>
-#include <import/ebistree.h>
#include <haproxy/acl.h>
#include <haproxy/api.h>
struct proxy *proxies_list = NULL; /* list of main proxies */
struct list proxies = LIST_HEAD_INIT(proxies); /* list of all proxies */
struct eb_root used_proxy_id = EB_ROOT; /* list of proxy IDs in use */
-struct eb_root proxy_by_name = EB_ROOT; /* tree of proxies sorted by name */
-struct eb_root defproxy_by_name = EB_ROOT; /* tree of default proxies sorted by name (dups possible) */
+struct ceb_root *proxy_by_name = NULL; /* tree of proxies sorted by name */
+struct ceb_root *defproxy_by_name = NULL; /* tree of default proxies sorted by name (dups possible) */
struct proxy *orphaned_default_proxies = NULL; /* deleted ones with refcount != 0 */
unsigned int error_snapshot_id = 0; /* global ID assigned to each error then incremented */
struct lf_expr *lf, *lfb;
/* note that the node's key points to p->id */
- ebpt_delete(&px->conf.by_name);
+ cebis_item_delete((px->cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name, conf.name_node, id, px);
ha_free(&px->id);
LIST_DEL_INIT(&px->global_list);
drop_file_name(&px->conf.file);
*/
void proxy_store_name(struct proxy *px)
{
- struct eb_root *root = (px->cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name;
+ struct ceb_root **root = (px->cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name;
- px->conf.by_name.key = px->id;
- ebis_insert(root, &px->conf.by_name);
+ cebis_item_insert(root, conf.name_node, id, px);
}
/* Returns a pointer to the first proxy matching capabilities <cap> and id
return curproxy;
}
else {
- struct eb_root *root;
- struct ebpt_node *node;
+ struct ceb_root **root;
root = (cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name;
- for (node = ebis_lookup(root, name); node; node = ebpt_next(node)) {
- curproxy = container_of(node, struct proxy, conf.by_name);
-
- if (strcmp(curproxy->id, name) != 0)
- break;
-
+ for (curproxy = cebis_item_lookup(root, conf.name_node, id, name, struct proxy);
+ curproxy; curproxy = cebis_item_next_dup(root, conf.name_node, id, curproxy)) {
if ((curproxy->cap & cap) != cap)
continue;
if (!(px->cap & PR_CAP_DEF))
return;
BUG_ON(px->conf.refcount != 0);
- ebpt_delete(&px->conf.by_name);
+ cebis_item_delete((px->cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name,
+ conf.name_node, id, px);
proxy_free_defaults(px);
free(px);
}
*/
void proxy_destroy_all_unref_defaults()
{
- struct ebpt_node *n;
struct proxy *px, *nx;
- n = ebpt_first(&defproxy_by_name);
- while (n) {
- px = container_of(n, struct proxy, conf.by_name);
+ for (px = cebis_item_first(&defproxy_by_name, conf.name_node, id, struct proxy); px; px = nx) {
BUG_ON(!(px->cap & PR_CAP_DEF));
- n = ebpt_next(n);
+ nx = cebis_item_next(&defproxy_by_name, conf.name_node, id, px);
if (!px->conf.refcount)
proxy_destroy_defaults(px);
}
if (!px || !(px->cap & PR_CAP_DEF))
return;
- ebpt_delete(&px->conf.by_name);
+ cebis_item_delete((px->cap & PR_CAP_DEF) ? &defproxy_by_name : &proxy_by_name, conf.name_node, id, px);
if (px->conf.refcount) {
/* still referenced just append it to the orphaned list */
px->next = orphaned_default_proxies;