From: Willy Tarreau Date: Tue, 31 May 2022 06:55:54 +0000 (+0200) Subject: CLEANUP: peers/cli: make peers_dump_peer() take an appctx instead of an stconn X-Git-Tag: v2.6.0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50e77b2b8569a5a61a5dbeafc89bac7647f4bcdb;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/peers.c b/src/peers.c index ae829e2a71..13f75ad9a1 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;