]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ring: Fix I/O handler of "show event" command to not rely on the SC
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Apr 2025 14:38:25 +0000 (16:38 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Apr 2025 13:09:37 +0000 (15:09 +0200)
Thanks to the CLI refactoring ("MAJOR: cli: Refacor parsing and execution of
pipelined commands"), it is possible to fix "show event" I/O handle function
to no longer use the SC.

When the applet API was refactored to no longer manipulate the channels or
the stream-connectors, this part was missed. However, without the patch
above, it could not be fixed. It is now possible so let's do it.

This patch must not be backported becaues it depends on refactoring of the
CLI applet.

src/ring.c

index fe03f3e369ed17bf0a3d5102ff2ba20e911c1255..a3c28b6fd33891d50db06008443f439b23171623 100644 (file)
@@ -696,7 +696,6 @@ int ring_dispatch_messages(struct ring *ring, void *ctx, size_t *ofs_ptr, size_t
 int cli_io_handler_show_ring(struct appctx *appctx)
 {
        struct show_ring_ctx *ctx = appctx->svcctx;
-       struct stconn *sc = appctx_sc(appctx);
        struct ring *ring = ctx->ring;
        size_t last_ofs;
        size_t ofs;
@@ -711,7 +710,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
                /* we've drained everything and are configured to wait for more
                 * data or an event (keypress, close)
                 */
-               if (!sc_oc(sc)->output && !(sc->flags & SC_FL_SHUT_DONE)) {
+               if (!b_data(&appctx->inbuf)) {
                        /* let's be woken up once new data arrive */
                        MT_LIST_APPEND(&ring->waiters, &appctx->wait_entry);
                        ofs = ring_tail(ring);
@@ -726,9 +725,11 @@ int cli_io_handler_show_ring(struct appctx *appctx)
                        ret = 0;
                }
                /* always drain all the request */
-               co_skip(sc_oc(sc), sc_oc(sc)->output);
+               b_reset(&appctx->inbuf);
+               applet_fl_clr(appctx, APPCTX_FL_INBLK_FULL);
        }
 
+       applet_will_consume(appctx);
        applet_expect_no_data(appctx);
        return ret;
 }