From 03dc54d802190dc690674bcc109cfd9fb26e34a6 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 23 Apr 2025 16:38:25 +0200 Subject: [PATCH] BUG/MINOR: ring: Fix I/O handler of "show event" command to not rely on the SC 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ring.c b/src/ring.c index fe03f3e36..a3c28b6fd 100644 --- a/src/ring.c +++ b/src/ring.c @@ -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; } -- 2.39.5