]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: replace conn_assign with conn_attach
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2013 13:31:04 +0000 (15:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:23 +0000 (15:40 +0100)
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().

include/proto/connection.h
include/proto/stream_interface.h
src/checks.c
src/session.c

index 5c72a95ae8bd90f4e9965b9797e4425acdc5cbe3..ce88f6e6b69c9a5541e980646c69725303e6e704 100644 (file)
@@ -548,14 +548,10 @@ static inline void conn_get_to_addr(struct connection *conn)
        conn->flags |= CO_FL_ADDR_TO_SET;
 }
 
-/* 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)
+/* Attaches a connection to an owner and assigns a data layer */
+static inline void conn_attach(struct connection *conn, void *owner, const struct data_cb *data)
 {
        conn->data = data;
-       conn->ctrl = ctrl;
-       conn->xprt = xprt;
        conn->owner = owner;
 }
 
index 8fc3281c95fcc1e19c4bf80aa98634b622cf7064..6bedaffcca43d7b1c6797957f7600416af006e5b 100644 (file)
@@ -88,7 +88,8 @@ static inline void si_prepare_conn(struct stream_interface *si, const struct pro
 
        si->ops = &si_conn_ops;
        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)
index b96f13dc8fba027e430db7f8e948a02322a1b7e0..ed459120c1781407540166f0ae6af5a7913067ef 100644 (file)
@@ -1542,7 +1542,7 @@ static struct task *process_chk(struct task *t)
                /* prepare a new connection */
                conn_init(conn);
                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;
 
                /* no client address */
index 9acfa7a0852c07fb09d3a87eaf45fedbf1c9c5fc..f8b29d54247d5efcd16a473468fb42b8c8ee6b03 100644 (file)
@@ -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
         * 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 */
        conn_ctrl_init(cli_conn);