mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: connection: replace conn_assign with conn_attach
We don't want to assign the control nor transport layers anymore at the same time as the data layer, because it prevents one from keeping existing settings when reattaching a connection to an existing stream interface. Let's have conn_attach() replace conn_assign() for this purpose. Thus, conn_prepare() + conn_attach() do exactly the same as the previous conn_assign().
This commit is contained in:
parent
910c6aa5b7
commit
7abddb5c67
@ -548,14 +548,10 @@ static inline void conn_get_to_addr(struct connection *conn)
|
|||||||
conn->flags |= CO_FL_ADDR_TO_SET;
|
conn->flags |= CO_FL_ADDR_TO_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assigns a connection with the appropriate data, ctrl, transport layers, and owner. */
|
/* Attaches a connection to an owner and assigns a data layer */
|
||||||
static inline void conn_assign(struct connection *conn, const struct data_cb *data,
|
static inline void conn_attach(struct connection *conn, void *owner, const struct data_cb *data)
|
||||||
const struct protocol *ctrl, const struct xprt_ops *xprt,
|
|
||||||
void *owner)
|
|
||||||
{
|
{
|
||||||
conn->data = data;
|
conn->data = data;
|
||||||
conn->ctrl = ctrl;
|
|
||||||
conn->xprt = xprt;
|
|
||||||
conn->owner = owner;
|
conn->owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,8 @@ static inline void si_prepare_conn(struct stream_interface *si, const struct pro
|
|||||||
|
|
||||||
si->ops = &si_conn_ops;
|
si->ops = &si_conn_ops;
|
||||||
si->end = &conn->obj_type;
|
si->end = &conn->obj_type;
|
||||||
conn_assign(conn, &si_conn_cb, ctrl, xprt, si);
|
conn_prepare(conn, ctrl, xprt);
|
||||||
|
conn_attach(conn, si, &si_conn_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void si_prepare_applet(struct stream_interface *si, struct si_applet *applet)
|
static inline void si_prepare_applet(struct stream_interface *si, struct si_applet *applet)
|
||||||
|
@ -1542,7 +1542,7 @@ static struct task *process_chk(struct task *t)
|
|||||||
/* prepare a new connection */
|
/* prepare a new connection */
|
||||||
conn_init(conn);
|
conn_init(conn);
|
||||||
conn_prepare(conn, s->check_common.proto, s->check_common.xprt);
|
conn_prepare(conn, s->check_common.proto, s->check_common.xprt);
|
||||||
conn_assign(conn, &check_conn_cb, s->check_common.proto, s->check_common.xprt, check);
|
conn_attach(conn, check, &check_conn_cb);
|
||||||
conn->target = &s->obj_type;
|
conn->target = &s->obj_type;
|
||||||
|
|
||||||
/* no client address */
|
/* no client address */
|
||||||
|
@ -203,7 +203,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
|||||||
* but not initialized. Also note we need to be careful as the stream
|
* but not initialized. Also note we need to be careful as the stream
|
||||||
* int is not initialized yet.
|
* int is not initialized yet.
|
||||||
*/
|
*/
|
||||||
conn_assign(cli_conn, &sess_conn_cb, l->proto, l->xprt, s);
|
conn_attach(cli_conn, s, &sess_conn_cb);
|
||||||
|
|
||||||
/* finish initialization of the accepted file descriptor */
|
/* finish initialization of the accepted file descriptor */
|
||||||
conn_ctrl_init(cli_conn);
|
conn_ctrl_init(cli_conn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user