From: Aurelien DARRAGON Date: Thu, 14 Sep 2023 22:29:53 +0000 (+0200) Subject: MINOR: sink: don't rely on p->parent in sink appctx X-Git-Tag: v2.9-dev7~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c53f6cb76e0cd8670b4df9d5bbd0a0b3e00b2f5;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/sink.c b/src/sink.c index 4b458279ec..a75cb7ed2b 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: