mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-20 04:37:04 +00:00
MINIOR: applet: Add flags to deal with ends of input, ends of stream and errors
Dedicated appctx flags to report EOI, EOS and errors (pending or terminal) were added with the functions to set these flags. It is pretty similar to what it done on most of muxes.
This commit is contained in:
parent
e8655546b7
commit
4434b03358
@ -41,6 +41,10 @@
|
||||
#define APPCTX_FL_INBLK_FULL 0x00000002
|
||||
#define APPCTX_FL_OUTBLK_ALLOC 0x00000004
|
||||
#define APPCTX_FL_OUTBLK_FULL 0x00000008
|
||||
#define APPCTX_FL_EOI 0x00000010
|
||||
#define APPCTX_FL_EOS 0x00000020
|
||||
#define APPCTX_FL_ERR_PENDING 0x00000040
|
||||
#define APPCTX_FL_ERROR 0x00000080
|
||||
|
||||
struct appctx;
|
||||
struct proxy;
|
||||
|
@ -157,6 +157,9 @@ static forceinline void applet_fl_setall(struct appctx *appctx, uint all)
|
||||
|
||||
static forceinline void applet_fl_set(struct appctx *appctx, uint on)
|
||||
{
|
||||
if (((on & (APPCTX_FL_EOS|APPCTX_FL_EOI)) && appctx->flags & APPCTX_FL_ERR_PENDING) ||
|
||||
((on & APPCTX_FL_ERR_PENDING) && appctx->flags & (APPCTX_FL_EOI|APPCTX_FL_EOS)))
|
||||
on |= APPCTX_FL_ERROR;
|
||||
appctx->flags |= on;
|
||||
}
|
||||
|
||||
@ -175,6 +178,24 @@ static forceinline uint applet_fl_get(const struct appctx *appctx)
|
||||
return appctx->flags;
|
||||
}
|
||||
|
||||
static inline void applet_set_eoi(struct appctx *appctx)
|
||||
{
|
||||
applet_fl_set(appctx, APPCTX_FL_EOI);
|
||||
}
|
||||
|
||||
static inline void applet_set_eos(struct appctx *appctx)
|
||||
{
|
||||
applet_fl_set(appctx, APPCTX_FL_EOS);
|
||||
}
|
||||
|
||||
static inline void applet_set_error(struct appctx *appctx)
|
||||
{
|
||||
if (applet_fl_test(appctx, (APPCTX_FL_EOS|APPCTX_FL_EOI)))
|
||||
applet_fl_set(appctx, APPCTX_FL_ERROR);
|
||||
else
|
||||
applet_fl_set(appctx, APPCTX_FL_ERR_PENDING);
|
||||
}
|
||||
|
||||
/* The applet announces it has more data to deliver to the stream's input
|
||||
* buffer.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user