MINOR: actions: add a function returning a service pointer from its name
authorThierry Fournier <thierry.fournier@ozon.io>
Sat, 28 Nov 2020 18:32:14 +0000 (19:32 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Dec 2020 10:40:21 +0000 (11:40 +0100)
This function simply calls action_lookup() on the private service_keywords,
to look up a service name. This will be used to detect double registration
of a same service from Lua.

This will be needed by a next patch to fix a bug and will have to be
backported.

(cherry picked from commit 87e539906b13ed1d86684d9d3eab82b550fae02d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 4b5382db22b39c168131c0d6335b0711dbb0b16d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit df7ddc887d66c2849c1d27dcd26348e5eec1aed3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

include/proto/stream.h
src/stream.c

index f8c0887..3aeea24 100644 (file)
@@ -413,6 +413,7 @@ static inline void stream_choose_redispatch(struct stream *s)
 }
 
 void service_keywords_register(struct action_kw_list *kw_list);
+struct action_kw *service_find(const char *kw);
 void list_services(FILE *out);
 
 #endif /* _PROTO_STREAM_H */
index ddf3b03..d6d07bc 100644 (file)
@@ -3235,6 +3235,11 @@ void service_keywords_register(struct action_kw_list *kw_list)
        LIST_ADDQ(&service_keywords, &kw_list->list);
 }
 
+struct action_kw *service_find(const char *kw)
+{
+       return action_lookup(&service_keywords, kw);
+}
+
 /* Lists the known services on <out> */
 void list_services(FILE *out)
 {