]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stick-table: lookup table names using trees.
authorWilly Tarreau <w@1wt.eu>
Sat, 15 Mar 2014 07:03:57 +0000 (08:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 15 Mar 2014 07:03:57 +0000 (08:03 +0100)
This will speed up config parsing time when many stick-table references
are used, as well as stick-table manipulations from the CLI.

src/stick_table.c

index 9a3e855a13c82eee3f1c4fa0537e4d3ac4a6f46b..92c4dd44cc8f7e3e4470085c60328d980023c691 100644 (file)
@@ -716,9 +716,15 @@ int stktable_get_data_type(char *name)
 struct proxy *find_stktable(const char *name)
 {
        struct proxy *px;
+       struct ebpt_node *node;
 
-       for (px = proxy; px; px = px->next) {
-               if (px->table.size && strcmp(px->id, name) == 0)
+       for (node = ebis_lookup(&proxy_by_name, name); node; node = ebpt_next(node)) {
+               px = container_of(node, struct proxy, conf.by_name);
+
+               if (strcmp(px->id, name) != 0)
+                       break;
+
+               if (px->table.size)
                        return px;
        }
        return NULL;