mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MINOR: applet: Add callback function to deal with zero-copy forwarding
This patch introduces the support for the callback function responsible to produce data via the zero-copy forwarding mechanism. There is no implementation for now. But <to_forward> field was added in the appctx structure to let an applet inform how much data it want to forward. It is not mandatory but it will be used during the zero-copy forwarding negociation.
This commit is contained in:
parent
7ec544b217
commit
62a81cb6a6
@ -63,7 +63,7 @@ struct applet {
|
||||
void (*fct)(struct appctx *); /* internal I/O handler, may never be NULL */
|
||||
size_t (*rcv_buf)(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags); /* called from the upper layer to get data */
|
||||
size_t (*snd_buf)(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags); /* Called from the upper layet to put data */
|
||||
/* TODO: ADD fastfwd callback functions */
|
||||
size_t (*fastfwd)(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags); /* Callback to fast-forward data */
|
||||
void (*release)(struct appctx *); /* callback to release resources, may be NULL */
|
||||
unsigned int timeout; /* execution timeout. */
|
||||
};
|
||||
@ -78,6 +78,7 @@ struct appctx {
|
||||
unsigned int flags; /* APPCTX_FL_* */
|
||||
struct buffer inbuf;
|
||||
struct buffer outbuf;
|
||||
size_t to_forward;
|
||||
|
||||
struct buffer *chunk; /* used to store unfinished commands */
|
||||
struct applet *applet; /* applet this context refers to */
|
||||
|
@ -138,9 +138,9 @@ static void applet_trace(enum trace_level level, uint64_t mask, const struct tra
|
||||
if (src->verbosity == STRM_VERB_CLEAN)
|
||||
return;
|
||||
|
||||
chunk_appendf(&trace_buf, " appctx=%p .t=%p .t.exp=%d .flags=0x%x .st0=%d .st1=%d",
|
||||
chunk_appendf(&trace_buf, " appctx=%p .t=%p .t.exp=%d .flags=0x%x .st0=%d .st1=%d to_fwd=%lu",
|
||||
appctx, appctx->t, tick_isset(appctx->t->expire) ? TICKS_TO_MS(appctx->t->expire - now_ms) : TICK_ETERNITY,
|
||||
appctx->flags, appctx->st0, appctx->st1);
|
||||
appctx->flags, appctx->st0, appctx->st1, appctx->to_forward);
|
||||
|
||||
if (!sc || src->verbosity == STRM_VERB_MINIMAL)
|
||||
return;
|
||||
@ -267,6 +267,7 @@ struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int t
|
||||
appctx->flags = 0;
|
||||
appctx->inbuf = BUF_NULL;
|
||||
appctx->outbuf = BUF_NULL;
|
||||
appctx->to_forward = 0;
|
||||
|
||||
LIST_INIT(&appctx->buffer_wait.list);
|
||||
appctx->buffer_wait.target = appctx;
|
||||
|
Loading…
Reference in New Issue
Block a user