diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index f4e424108..86e08c319 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -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 */ diff --git a/src/applet.c b/src/applet.c index 2d88904f9..4ddb0da3b 100644 --- a/src/applet.c +++ b/src/applet.c @@ -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;