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.
This commit is contained in:
Aurelien DARRAGON 2023-09-15 01:49:08 +02:00 committed by Christopher Faulet
parent 405567c125
commit 205d480d9f
2 changed files with 5 additions and 3 deletions

View File

@ -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 */

View File

@ -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
*/