From 50e77b2b8569a5a61a5dbeafc89bac7647f4bcdb Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 31 May 2022 08:55:54 +0200 Subject: [PATCH] CLEANUP: peers/cli: make peers_dump_peer() take an appctx instead of an stconn By having the appctx in argument this function wouldn't have experienced the previous bug. Better do that now to avoid proliferation of awkward functions. --- src/peers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/peers.c b/src/peers.c index ae829e2a7..13f75ad9a 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3771,7 +3771,7 @@ static int peers_dump_head(struct buffer *msg, struct appctx *appctx, struct pee * Returns 0 if the output buffer is full and needs to be called again, non-zero * if not. Dedicated to be called by cli_io_handler_show_peers() cli I/O handler. */ -static int peers_dump_peer(struct buffer *msg, struct stconn *sc, struct peer *peer, int flags) +static int peers_dump_peer(struct buffer *msg, struct appctx *appctx, struct peer *peer, int flags) { struct connection *conn; char pn[INET6_ADDRSTRLEN]; @@ -3916,7 +3916,7 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *sc, struct peer *p end: chunk_appendf(&trash, "\n"); - if (applet_putchk(sc_appctx(sc), msg) == -1) + if (applet_putchk(appctx, msg) == -1) return 0; return 1; @@ -3967,7 +3967,7 @@ static int cli_io_handler_show_peers(struct appctx *appctx) ctx->state = STATE_DONE; } else { - if (!peers_dump_peer(&trash, appctx_sc(appctx), ctx->peer, ctx->flags)) + if (!peers_dump_peer(&trash, appctx, ctx->peer, ctx->flags)) goto out; ctx->peer = ctx->peer->next; -- 2.47.3