mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
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.
This commit is contained in:
parent
ec770b7924
commit
3c53f6cb76
12
src/sink.c
12
src/sink.c
@ -314,9 +314,8 @@ void sink_setup_proxy(struct proxy *px)
|
|||||||
static void sink_forward_io_handler(struct appctx *appctx)
|
static void sink_forward_io_handler(struct appctx *appctx)
|
||||||
{
|
{
|
||||||
struct stconn *sc = appctx_sc(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_forward_target *sft = appctx->svcctx;
|
||||||
|
struct sink *sink = sft->sink;
|
||||||
struct ring *ring = sink->ctx.ring;
|
struct ring *ring = sink->ctx.ring;
|
||||||
struct buffer *buf = &ring->buf;
|
struct buffer *buf = &ring->buf;
|
||||||
uint64_t msg_len;
|
uint64_t msg_len;
|
||||||
@ -445,9 +444,8 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
|||||||
static void sink_forward_oc_io_handler(struct appctx *appctx)
|
static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||||
{
|
{
|
||||||
struct stconn *sc = appctx_sc(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_forward_target *sft = appctx->svcctx;
|
||||||
|
struct sink *sink = sft->sink;
|
||||||
struct ring *ring = sink->ctx.ring;
|
struct ring *ring = sink->ctx.ring;
|
||||||
struct buffer *buf = &ring->buf;
|
struct buffer *buf = &ring->buf;
|
||||||
uint64_t msg_len;
|
uint64_t msg_len;
|
||||||
@ -567,10 +565,9 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
|||||||
|
|
||||||
void __sink_forward_session_deinit(struct sink_forward_target *sft)
|
void __sink_forward_session_deinit(struct sink_forward_target *sft)
|
||||||
{
|
{
|
||||||
struct stream *s = appctx_strm(sft->appctx);
|
|
||||||
struct sink *sink;
|
struct sink *sink;
|
||||||
|
|
||||||
sink = strm_fe(s)->parent;
|
sink = sft->sink;
|
||||||
if (!sink)
|
if (!sink)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -838,9 +835,6 @@ static struct sink *sink_new_ringbuf(const char *id, const char *description,
|
|||||||
/* link sink to proxy */
|
/* link sink to proxy */
|
||||||
sink->forward_px = p;
|
sink->forward_px = p;
|
||||||
|
|
||||||
/* link proxy to sink */
|
|
||||||
p->parent = sink;
|
|
||||||
|
|
||||||
return sink;
|
return sink;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
Loading…
Reference in New Issue
Block a user