mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: stream-int: split si_prepare_embedded into si_prepare_none and si_prepare_applet
si_prepare_embedded() was used both to attach an applet and to detach anything from a stream interface. Split it into si_prepare_none() to detach and si_prepare_applet() to attach an applet. si->conn->target is now assigned from within these two functions instead of their respective callers.
This commit is contained in:
parent
9b6c2c721e
commit
372d6708fb
@ -51,6 +51,13 @@ static inline const struct protocol *si_ctrl(struct stream_interface *si)
|
|||||||
return si->conn->ctrl;
|
return si->conn->ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void si_prepare_none(struct stream_interface *si)
|
||||||
|
{
|
||||||
|
si->ops = &si_embedded_ops;
|
||||||
|
conn_prepare(si->conn, NULL, NULL, NULL, si);
|
||||||
|
si->conn->target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
|
static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
|
||||||
{
|
{
|
||||||
si->ops = &si_conn_ops;
|
si->ops = &si_conn_ops;
|
||||||
@ -63,10 +70,11 @@ static inline void si_takeover_conn(struct stream_interface *si, const struct pr
|
|||||||
conn_assign(si->conn, &si_conn_cb, ctrl, xprt, si);
|
conn_assign(si->conn, &si_conn_cb, ctrl, xprt, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void si_prepare_embedded(struct stream_interface *si)
|
static inline void si_prepare_applet(struct stream_interface *si, struct si_applet *applet)
|
||||||
{
|
{
|
||||||
si->ops = &si_embedded_ops;
|
si->ops = &si_embedded_ops;
|
||||||
conn_prepare(si->conn, NULL, NULL, NULL, si);
|
conn_prepare(si->conn, NULL, NULL, NULL, si);
|
||||||
|
si->conn->target = &applet->obj_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sends a shutr to the connection using the data layer */
|
/* Sends a shutr to the connection using the data layer */
|
||||||
|
@ -469,8 +469,7 @@ int session_complete(struct session *s)
|
|||||||
s->si[1].conn_retries = 0; /* used for logging too */
|
s->si[1].conn_retries = 0; /* used for logging too */
|
||||||
s->si[1].release = NULL;
|
s->si[1].release = NULL;
|
||||||
s->si[1].send_proxy_ofs = 0;
|
s->si[1].send_proxy_ofs = 0;
|
||||||
s->si[1].conn->target = NULL;
|
si_prepare_none(&s->si[1]);
|
||||||
si_prepare_embedded(&s->si[1]);
|
|
||||||
s->si[1].exp = TICK_ETERNITY;
|
s->si[1].exp = TICK_ETERNITY;
|
||||||
s->si[1].flags = SI_FL_NONE;
|
s->si[1].flags = SI_FL_NONE;
|
||||||
|
|
||||||
|
@ -358,8 +358,7 @@ struct task *stream_int_register_handler(struct stream_interface *si, struct si_
|
|||||||
{
|
{
|
||||||
DPRINTF(stderr, "registering handler %p for si %p (was %p)\n", app, si, si->owner);
|
DPRINTF(stderr, "registering handler %p for si %p (was %p)\n", app, si, si->owner);
|
||||||
|
|
||||||
si_prepare_embedded(si);
|
si_prepare_applet(si, app);
|
||||||
si->conn->target = &app->obj_type;
|
|
||||||
si->release = app->release;
|
si->release = app->release;
|
||||||
si->flags |= SI_FL_WAIT_DATA;
|
si->flags |= SI_FL_WAIT_DATA;
|
||||||
return si->owner;
|
return si->owner;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user