mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 23:01:03 +01:00
MINOR: connection: split conn_prepare() in two functions
We'll also need a function to takeover an existing connection without reinitializing it. The same will be needed at the stream interface level.
This commit is contained in:
parent
4aa3683b2d
commit
bd99aab91f
@ -412,10 +412,8 @@ static inline void conn_get_to_addr(struct connection *conn)
|
|||||||
conn->flags |= CO_FL_ADDR_TO_SET;
|
conn->flags |= CO_FL_ADDR_TO_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prepares a connection with the appropriate data, ctrl and transport layers.
|
/* Assigns a connection with the appropriate data, ctrl, transport layers, and owner. */
|
||||||
* The data state and context are set to 0, and the connection's owner is set.
|
static inline void conn_assign(struct connection *conn, const struct data_cb *data,
|
||||||
*/
|
|
||||||
static inline void conn_prepare(struct connection *conn, const struct data_cb *data,
|
|
||||||
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
||||||
void *owner)
|
void *owner)
|
||||||
{
|
{
|
||||||
@ -423,6 +421,16 @@ static inline void conn_prepare(struct connection *conn, const struct data_cb *d
|
|||||||
conn->ctrl = ctrl;
|
conn->ctrl = ctrl;
|
||||||
conn->xprt = xprt;
|
conn->xprt = xprt;
|
||||||
conn->owner = owner;
|
conn->owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prepares a connection with the appropriate data, ctrl, transport layers, and
|
||||||
|
* owner. The transport state and context are set to 0.
|
||||||
|
*/
|
||||||
|
static inline void conn_prepare(struct connection *conn, const struct data_cb *data,
|
||||||
|
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
||||||
|
void *owner)
|
||||||
|
{
|
||||||
|
conn_assign(conn, data, ctrl, xprt, owner);
|
||||||
conn->xprt_st = 0;
|
conn->xprt_st = 0;
|
||||||
conn->xprt_ctx = NULL;
|
conn->xprt_ctx = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,6 +67,12 @@ static inline void si_prepare_conn(struct stream_interface *si, const struct pro
|
|||||||
conn_prepare(&si->conn, &si_conn_cb, ctrl, xprt, si);
|
conn_prepare(&si->conn, &si_conn_cb, ctrl, xprt, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void si_takeover_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
|
||||||
|
{
|
||||||
|
si->ops = &si_conn_ops;
|
||||||
|
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_embedded(struct stream_interface *si)
|
||||||
{
|
{
|
||||||
si->ops = &si_embedded_ops;
|
si->ops = &si_embedded_ops;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user