diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index 9ee8f5d9cf..8360c85576 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -46,6 +46,7 @@ #define APPCTX_FL_ERROR 0x00000080 #define APPCTX_FL_SHUTDOWN 0x00000100 /* applet was shut down (->release() called if any). No more data exchange with SCs */ #define APPCTX_FL_WANT_DIE 0x00000200 /* applet was running and requested to die */ +#define APPCTX_FL_INOUT_BUFS 0x00000400 /* applet uses its own buffers */ struct appctx; struct proxy; diff --git a/src/applet.c b/src/applet.c index 362811718f..984ff2661b 100644 --- a/src/applet.c +++ b/src/applet.c @@ -260,17 +260,20 @@ struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int t } appctx->sedesc = sedesc; - if (applet->rcv_buf != NULL && applet->snd_buf != NULL) - appctx->t->process = task_process_applet; - else - appctx->t->process = task_run_applet; - appctx->t->context = appctx; appctx->flags = 0; appctx->inbuf = BUF_NULL; appctx->outbuf = BUF_NULL; appctx->to_forward = 0; + if (applet->rcv_buf != NULL && applet->snd_buf != NULL) { + appctx->t->process = task_process_applet; + appctx->flags |= APPCTX_FL_INOUT_BUFS; + } + else + appctx->t->process = task_run_applet; + appctx->t->context = appctx; + LIST_INIT(&appctx->buffer_wait.list); appctx->buffer_wait.target = appctx; appctx->buffer_wait.wakeup_cb = appctx_buf_available;