mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +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,17 +412,25 @@ static inline void conn_get_to_addr(struct connection *conn)
|
||||
conn->flags |= CO_FL_ADDR_TO_SET;
|
||||
}
|
||||
|
||||
/* prepares a connection with the appropriate data, ctrl and transport layers.
|
||||
* The data state and context are set to 0, and the connection's owner is set.
|
||||
*/
|
||||
static inline void conn_prepare(struct connection *conn, const struct data_cb *data,
|
||||
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
||||
void *owner)
|
||||
/* Assigns a connection with the appropriate data, ctrl, transport layers, and owner. */
|
||||
static inline void conn_assign(struct connection *conn, const struct data_cb *data,
|
||||
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
||||
void *owner)
|
||||
{
|
||||
conn->data = data;
|
||||
conn->ctrl = ctrl;
|
||||
conn->xprt = xprt;
|
||||
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_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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
si->ops = &si_embedded_ops;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user