]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: peers/cli: make peers_dump_peer() take an appctx instead of an stconn
authorWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 06:55:54 +0000 (08:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 06:55:54 +0000 (08:55 +0200)
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

index ae829e2a717b4ef004b5127115edbc628cce0e86..13f75ad9a19c9751448c821ca880972bd04ad5fa 100644 (file)
@@ -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;