From: Aurelien DARRAGON Date: Thu, 14 Sep 2023 23:49:08 +0000 (+0200) Subject: MINOR: sink: refine forward_px usage X-Git-Tag: v2.9-dev7~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=205d480d9fe43064b51f5907e6734696070b0441;p=thirdparty%2Fhaproxy.git MINOR: sink: refine forward_px usage now forward_px only serves as a hint to know if a proxy was created specifically for the sink, in which case the sink is responsible for it. Everywhere forward_px was used in appctx context: get the parent proxy from the sft->srv instead. This permits to finally get rid of the double link dependency between sink and proxy. --- diff --git a/include/haproxy/sink-t.h b/include/haproxy/sink-t.h index b5138c85da..79a0ddade6 100644 --- a/include/haproxy/sink-t.h +++ b/include/haproxy/sink-t.h @@ -54,7 +54,7 @@ struct sink { enum log_fmt fmt; // format expected by the sink enum sink_type type; // type of storage uint32_t maxlen; // max message length (truncated above) - struct proxy* forward_px; // proxy used to forward + struct proxy* forward_px; // internal proxy used to forward (only set when exclusive to sink) struct sink_forward_target *sft; // sink forward targets struct task *forward_task; // task to handle forward targets conns struct sig_handler *forward_sighandler; /* signal handler */ diff --git a/src/sink.c b/src/sink.c index ae64b5537c..d456ca20ff 100644 --- a/src/sink.c +++ b/src/sink.c @@ -588,7 +588,7 @@ static int sink_forward_session_init(struct appctx *appctx) if (!sockaddr_alloc(&addr, &sft->srv->addr, sizeof(sft->srv->addr))) goto out_error; - if (appctx_finalize_startup(appctx, sft->sink->forward_px, &BUF_NULL) == -1) + if (appctx_finalize_startup(appctx, sft->srv->proxy, &BUF_NULL) == -1) goto out_free_addr; s = appctx_strm(appctx); @@ -803,7 +803,9 @@ static void sink_free(struct sink *sink) } /* Helper function to create new high-level ring buffer (as in ring section from - * the config) + * the config): will create a new sink of buf type, and a new forward proxy, + * which will be stored in forward_px to know that the sink is responsible for + * it. * * Returns NULL on failure */