mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-06 13:33:02 +00:00
MINOR: stconn: Be prepared to handle error when a SC is attached to an applet
sc_attach_applet() was changed to be able to fail and callers were updated accordingly. For now it cannot fail but if this changes, callers will be prepared to handle errors.
This commit is contained in:
parent
ad937372f3
commit
45ca9dadcd
@ -312,7 +312,7 @@ int sc_attach_mux(struct stconn *sc, void *sd, void *ctx)
|
||||
* removed. This function is called by a stream when a backend applet is
|
||||
* registered.
|
||||
*/
|
||||
static void sc_attach_applet(struct stconn *sc, struct appctx *appctx)
|
||||
static int sc_attach_applet(struct stconn *sc, struct appctx *appctx)
|
||||
{
|
||||
sc->sedesc->se = appctx;
|
||||
sc_ep_set(sc, SE_FL_T_APPLET);
|
||||
@ -321,6 +321,8 @@ static void sc_attach_applet(struct stconn *sc, struct appctx *appctx)
|
||||
sc->app_ops = &sc_app_applet_ops;
|
||||
xref_create(&sc->sedesc->xref, &sc_opposite(sc)->sedesc->xref);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Attaches a stconn to a app layer and sets the relevant
|
||||
@ -506,7 +508,10 @@ struct appctx *sc_applet_create(struct stconn *sc, struct applet *app)
|
||||
appctx = appctx_new_here(app, sc->sedesc);
|
||||
if (!appctx)
|
||||
return NULL;
|
||||
sc_attach_applet(sc, appctx);
|
||||
if (sc_attach_applet(sc, appctx) == -1) {
|
||||
appctx_free_on_early_error(appctx);
|
||||
return NULL;
|
||||
}
|
||||
appctx->t->nice = __sc_strm(sc)->task->nice;
|
||||
applet_need_more_data(appctx);
|
||||
appctx_wakeup(appctx);
|
||||
|
Loading…
Reference in New Issue
Block a user