diff --git a/include/haproxy/stick_table-t.h b/include/haproxy/stick_table-t.h index 572ed96fe..19dc60088 100644 --- a/include/haproxy/stick_table-t.h +++ b/include/haproxy/stick_table-t.h @@ -23,6 +23,7 @@ #ifndef _HAPROXY_STICK_TABLE_T_H #define _HAPROXY_STICK_TABLE_T_H +#include #include #include @@ -166,13 +167,13 @@ struct stksess { /* stick table */ struct stktable { - char *id; /* local table id name. */ - size_t idlen; /* local table id name length. */ + char *id; /* local table id name, indexed by below. */ + size_t idlen; /* local table id name length. */ char *nid; /* table id name sent over the network with peers protocol. */ struct stktable *next; /* The stick-table may be linked when belonging to * the same configuration section. */ - struct ebpt_node name; /* Stick-table are lookup by name here. */ + struct ceb_node id_node; /* Stick-table are lookup by name here, indexes above. */ struct pool_head *pool; /* pool used to allocate sticky sessions */ struct task *exp_task; /* expiration task */ struct task *sync_task; /* sync task */ diff --git a/src/stick_table.c b/src/stick_table.c index b3ff76878..73352d877 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -14,9 +14,9 @@ #include #include +#include #include #include -#include #include #include @@ -64,7 +64,7 @@ static THREAD_LOCAL struct stktable_key static_table_key; static int (*smp_fetch_src)(const struct arg *, struct sample *, const char *, void *); struct pool_head *pool_head_stk_ctr __read_mostly = NULL; struct stktable *stktables_list; -struct eb_root stktable_by_name = EB_ROOT; +struct ceb_root *stktable_by_name = NULL; #define round_ptr_size(i) (((i) + (sizeof(void *) - 1)) &~ (sizeof(void *) - 1)) @@ -74,23 +74,12 @@ struct eb_root stktable_by_name = EB_ROOT; */ void stktable_store_name(struct stktable *t) { - t->name.key = t->id; - ebis_insert(&stktable_by_name, &t->name); + cebis_item_insert(&stktable_by_name, id_node, id, t); } struct stktable *stktable_find_by_name(const char *name) { - struct ebpt_node *node; - struct stktable *t; - - node = ebis_lookup(&stktable_by_name, name); - if (node) { - t = container_of(node, struct stktable, name); - if (strcmp(t->id, name) == 0) - return t; - } - - return NULL; + return cebis_item_lookup(&stktable_by_name, id_node, id, name, struct stktable); } /*