MINOR: cli: create cli_raw_rcv_buf() from the generic applet_raw_rcv_buf()

This is in preparation for a future fix. For now it's simply a pure
copy of the original function, but dedicated to the CLI. It will
have to be backported to 3.0.
This commit is contained in:
Willy Tarreau 2025-10-27 15:48:04 +01:00
parent 35106d65fb
commit f38ea2731b

View File

@ -3902,12 +3902,17 @@ error:
return -1; return -1;
} }
size_t cli_raw_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags)
{
return b_xfer(buf, &appctx->outbuf, MIN(count, b_data(&appctx->outbuf)));
}
static struct applet cli_applet = { static struct applet cli_applet = {
.obj_type = OBJ_TYPE_APPLET, .obj_type = OBJ_TYPE_APPLET,
.flags = APPLET_FL_NEW_API, .flags = APPLET_FL_NEW_API,
.name = "<CLI>", /* used for logging */ .name = "<CLI>", /* used for logging */
.fct = cli_io_handler, .fct = cli_io_handler,
.rcv_buf = appctx_raw_rcv_buf, .rcv_buf = cli_raw_rcv_buf,
.snd_buf = appctx_raw_snd_buf, .snd_buf = appctx_raw_snd_buf,
.release = cli_release_handler, .release = cli_release_handler,
}; };
@ -3918,7 +3923,7 @@ static struct applet mcli_applet = {
.flags = APPLET_FL_NEW_API, .flags = APPLET_FL_NEW_API,
.name = "<MCLI>", /* used for logging */ .name = "<MCLI>", /* used for logging */
.fct = cli_io_handler, .fct = cli_io_handler,
.rcv_buf = appctx_raw_rcv_buf, .rcv_buf = cli_raw_rcv_buf,
.snd_buf = appctx_raw_snd_buf, .snd_buf = appctx_raw_snd_buf,
.release = cli_release_handler, .release = cli_release_handler,
}; };