]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: connection: replace conn_prepare with conn_assign
authorWilly Tarreau <w@1wt.eu>
Mon, 14 Oct 2013 17:46:29 +0000 (19:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:23 +0000 (15:40 +0100)
Everywhere conn_prepare() is used, the call to conn_init() has already
been done. We can now safely replace all instances of conn_prepare()
with conn_assign() which does not reset the transport layer, and remove
conn_prepare().

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

index bd3e890f1fb65f14f45972f21f78d7c57b9fdc25..a552a043803b36c4d0e3c70e94c97e523eb39d4a 100644 (file)
@@ -486,18 +486,6 @@ static inline void conn_assign(struct connection *conn, const struct data_cb *da
        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;
-}
-
 /* returns a human-readable error code for conn->err_code, or NULL if the code
  * is unknown.
  */
index d1c2b36bd86da0b799bdb88673f9ab772170ae01..3349ddec2a3dbd975f2f6a785dcf328eeb7cc8c1 100644 (file)
@@ -63,7 +63,7 @@ static inline void si_prepare_conn(struct stream_interface *si, const struct pro
 
        si->ops = &si_conn_ops;
        si->end = &conn->obj_type;
-       conn_prepare(conn, &si_conn_cb, ctrl, xprt, si);
+       conn_assign(conn, &si_conn_cb, ctrl, xprt, si);
 }
 
 /* Assign the stream interface's pre-allocated connection to the end point,
index d781b4c003a16cdcd7d692c5399fc2d1e114854e..c38a1c9727225a8014183659ddd1ca01e382d88a 100644 (file)
@@ -1541,7 +1541,7 @@ static struct task *process_chk(struct task *t)
 
                /* prepare a new connection */
                conn_init(conn);
-               conn_prepare(conn, &check_conn_cb, s->check_common.proto, s->check_common.xprt, check);
+               conn_assign(conn, &check_conn_cb, s->check_common.proto, s->check_common.xprt, check);
                conn->target = &s->obj_type;
 
                /* no client address */
index 9afa1f517c73621a007e1c21b97bc0b16773b34d..b8b5b4980eaad913201b9336768a8706a03a954e 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_prepare(cli_conn, &sess_conn_cb, l->proto, l->xprt, s);
+       conn_assign(cli_conn, &sess_conn_cb, l->proto, l->xprt, s);
 
        /* finish initialization of the accepted file descriptor */
        fd_insert(cfd);