From 3c53f6cb76e0cd8670b4df9d5bbd0a0b3e00b2f5 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Fri, 15 Sep 2023 00:29:53 +0200 Subject: [PATCH] MINOR: sink: don't rely on p->parent in sink appctx Removing unnecessary dependency on proxy->parent pointer in sink appctx functions by directly using the sink sft from the applet->svcctx to get back to sink related structs. Thanks to this, proxy used for a ringbuf does not have to be exclusive to a single sink anymore. --- src/sink.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/sink.c b/src/sink.c index 4b458279e..a75cb7ed2 100644 --- a/src/sink.c +++ b/src/sink.c @@ -314,9 +314,8 @@ void sink_setup_proxy(struct proxy *px) static void sink_forward_io_handler(struct appctx *appctx) { struct stconn *sc = appctx_sc(appctx); - struct stream *s = __sc_strm(sc); - struct sink *sink = strm_fe(s)->parent; struct sink_forward_target *sft = appctx->svcctx; + struct sink *sink = sft->sink; struct ring *ring = sink->ctx.ring; struct buffer *buf = &ring->buf; uint64_t msg_len; @@ -445,9 +444,8 @@ close: static void sink_forward_oc_io_handler(struct appctx *appctx) { struct stconn *sc = appctx_sc(appctx); - struct stream *s = __sc_strm(sc); - struct sink *sink = strm_fe(s)->parent; struct sink_forward_target *sft = appctx->svcctx; + struct sink *sink = sft->sink; struct ring *ring = sink->ctx.ring; struct buffer *buf = &ring->buf; uint64_t msg_len; @@ -567,10 +565,9 @@ close: void __sink_forward_session_deinit(struct sink_forward_target *sft) { - struct stream *s = appctx_strm(sft->appctx); struct sink *sink; - sink = strm_fe(s)->parent; + sink = sft->sink; if (!sink) return; @@ -838,9 +835,6 @@ static struct sink *sink_new_ringbuf(const char *id, const char *description, /* link sink to proxy */ sink->forward_px = p; - /* link proxy to sink */ - p->parent = sink; - return sink; err: -- 2.47.3