BUG/MINOR: hlua: Fix I/O handler of lua CLI commands 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 the I/O handler function used by
lua CLI commands 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.
This commit is contained in:
Christopher Faulet 2025-04-23 16:32:55 +02:00
parent 742dc01537
commit e406fe16ea

View File

@ -11895,11 +11895,9 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
{ {
struct hlua_cli_ctx *ctx = appctx->svcctx; struct hlua_cli_ctx *ctx = appctx->svcctx;
struct hlua *hlua; struct hlua *hlua;
struct stconn *sc;
struct hlua_function *fcn; struct hlua_function *fcn;
hlua = ctx->hlua; hlua = ctx->hlua;
sc = appctx_sc(appctx);
fcn = ctx->fcn; fcn = ctx->fcn;
/* Execute the function. */ /* Execute the function. */
@ -11913,10 +11911,13 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
case HLUA_E_AGAIN: case HLUA_E_AGAIN:
/* We want write. */ /* We want write. */
if (HLUA_IS_WAKERESWR(hlua)) if (HLUA_IS_WAKERESWR(hlua))
sc_need_room(sc, -1); applet_have_more_data(appctx);
/* Set the timeout. */ /* Set the timeout. */
if (hlua->wake_time != TICK_ETERNITY) if (hlua->wake_time != TICK_ETERNITY)
task_schedule(hlua->task, hlua->wake_time); task_schedule(hlua->task, hlua->wake_time);
applet_will_consume(appctx);
applet_expect_data(appctx);
return 0; return 0;
/* finished with error. */ /* finished with error. */