]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: applet: add new wrappers to put chk/blk/str/chr to channel from appctx
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 09:38:31 +0000 (11:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
commit15c25d5e1dbf81b19dac3e89a123b2b11c0dd69c
treed798f1be185007677e0a9ee3e94fe2b77aaf596d
parent2f2318df87a1023593462b262723c1120024f041
MINOR: applet: add new wrappers to put chk/blk/str/chr to channel from appctx

The vast majority of calls to ci_putchk() etc are performed from applets
which directly know an endpoint. Figuring the correct API (writing into
input channel etc) isn't trivial for newcomers, and knowing that they
must mark the flag indicating a buffer full condition isn't trivial
either.

Here we're adding wrappers to these functions but to be used directly
from the appctx. That's already what is being done in multiple steps in
the applet code, where the endp is derived from the appctx, then the cs
from the endp, then the stream from the cs, then the channel from the
stream, and so on. But this time the function doesn't require to know
much of the internals, applet_putchr() writes a char from the appctx,
and marks the buffer full if needed. Period. This will allow to remove
a significant amount of obscure ci_putchk() and cs_ic() calls from the
code, hence a significant number of possible mistakes.
include/haproxy/applet.h