MINOR: server: use stress mode for "add server help"

Implement stress mode on "add server help". This ensures that the
command is fully reentrant on full output buffer.

For testing, it requires compilation with USE_STRESS and global setting
"stress-level 1".
This commit is contained in:
Amaury Denoyelle 2025-05-22 17:13:20 +02:00
parent 4de5090976
commit 5e088e3f8e

View File

@ -43,6 +43,7 @@
#include <haproxy/stats.h>
#include <haproxy/stconn.h>
#include <haproxy/stream.h>
#include <haproxy/stress.h>
#include <haproxy/task.h>
#include <haproxy/tcpcheck.h>
#include <haproxy/time.h>
@ -5855,8 +5856,10 @@ int cli_io_handler_add_server(struct appctx *appctx)
ctx->obj2 = kw;
chunk_reset(&trash);
chunk_printf(&trash, "%s\n", kw->kw);
if (applet_putchk(appctx, &trash) == -1)
if (STRESS_RUN1(applet_putchk_stress(appctx, &trash) == -1,
applet_putchk(appctx, &trash) == -1)) {
goto full;
}
}
kwl = LIST_NEXT(&kwl->list, struct srv_kw_list *, list);