mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-02-15 22:31:29 +01:00
MEDIUM: applet: Set .rcv_buf and .snd_buf functions on default ones if not set
Based on the applet flags, it is possible to set .rcv_buf and .snd_buf callback functions if necessary. If these functions are not defined for an applet using the new API, it means the default functions must be used. We also take care to choose the raw version or the htx version, depending on the applet flags.
This commit is contained in:
parent
71c01c1010
commit
b4a92e7cb1
17
src/applet.c
17
src/applet.c
@ -274,9 +274,20 @@ struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int t
|
||||
appctx->outbuf = BUF_NULL;
|
||||
appctx->to_forward = 0;
|
||||
|
||||
appctx->t->process = ((applet->flags & APPLET_FL_NEW_API)
|
||||
? task_process_applet
|
||||
: task_run_applet);
|
||||
if (applet->flags & APPLET_FL_NEW_API) {
|
||||
appctx->t->process = task_process_applet;
|
||||
/* Automatically set .rcv_buf and .snd_buf callback functions on default ones if not set */
|
||||
if (applet->rcv_buf == NULL)
|
||||
applet->rcv_buf = (applet->flags & APPLET_FL_HTX
|
||||
? appctx_htx_rcv_buf
|
||||
: appctx_raw_rcv_buf);
|
||||
if (applet->snd_buf == NULL)
|
||||
applet->snd_buf = (applet->flags & APPLET_FL_HTX
|
||||
? appctx_htx_snd_buf
|
||||
: appctx_raw_snd_buf);
|
||||
}
|
||||
else
|
||||
appctx->t->process = task_run_applet;
|
||||
appctx->t->context = appctx;
|
||||
|
||||
LIST_INIT(&appctx->buffer_wait.list);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user