]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: proxy: add e_sub proxy subscrition list
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 6 Oct 2026 21:08:24 +0000 (23:08 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 12 Oct 2026 07:38:37 +0000 (09:38 +0200)
add e_sub member to proxy struct so that it becomes possible to register
to PROXY events for a given proxy.

include/haproxy/proxy-t.h
src/proxy.c

index 24b4c72a3739b6ea8f32041aaa833e666689178a..51c0f3eadfcfefae6a0498d8a3f37ef3e5d7cd18 100644 (file)
@@ -465,6 +465,8 @@ struct proxy {
        unsigned int li_ready;                  /* total number of listeners ready (>=LI_READY) */
        unsigned int li_suspended;              /* total number of listeners suspended (could be paused or unbound) */
 
+       event_hdl_sub_list e_subs;              /* event_hdl: proxy's subscribers list (atomically updated) */
+
        /* warning: these structs are huge, keep them at the bottom */
        struct error_snapshot *invalid_req, *invalid_rep; /* captures of last errors */
 
index 9b410cd0111ca88a3c028b5d6d40c7571e8c8b98..c70fc9cea88427f557d4733aa378db101b482927 100644 (file)
@@ -28,6 +28,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/counters.h>
 #include <haproxy/errors.h>
+#include <haproxy/event_hdl.h>
 #include <haproxy/fd.h>
 #include <haproxy/filters.h>
 #include <haproxy/frontend.h>
@@ -478,6 +479,8 @@ void deinit_proxy(struct proxy *p)
        pool_destroy(p->req_cap_pool);
        pool_destroy(p->rsp_cap_pool);
 
+       event_hdl_sub_list_destroy(&p->e_subs);
+
        stktable_deinit(p->table);
        ha_free(&p->table);
        ha_free(&p->per_tgrp);
@@ -3268,8 +3271,10 @@ int setup_new_proxy(struct proxy *px, const char *name, unsigned int cap, char *
        if (name && name[0] != '\0' && !(cap & PR_CAP_INT))
                proxy_store_name(px);
 
-       if (!(cap & PR_CAP_DEF))
+       if (!(cap & PR_CAP_DEF)) {
                LIST_APPEND(&all_proxies, &px->global_list);
+               event_hdl_sub_list_init(&px->e_subs);
+       }
 
        return 1;