]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_conn_get_first() to conn_get_first_sc()
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 16:11:27 +0000 (18:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
It returns an stconn from a connection and not the opposite, so the name
change was more appropriate. In addition it was moved to connection.h
which manipulates the connection stuff, and it happens that only
connection.c uses it.

include/haproxy/conn_stream.h
include/haproxy/connection.h
src/connection.c

index 112b27e2a3a7ac1ddd27d3ad0b4bc6c883a528f1..e3d2b71f79969b0aeb4b8213a2d205b6f718c287 100644 (file)
@@ -283,25 +283,6 @@ static inline void cs_ep_set_error(struct sedesc *endp)
                se_fl_set(endp, SE_FL_ERR_PENDING);
 }
 
-/* Retrieves any valid stream connector from this connection, preferably the first
- * valid one. The purpose is to be able to figure one other end of a private
- * connection for purposes like source binding or proxy protocol header
- * emission. In such cases, any stream connector is expected to be valid so the
- * mux is encouraged to return the first one it finds. If the connection has
- * no mux or the mux has no get_first_cs() method or the mux has no valid
- * stream connector, NULL is returned. The output pointer is purposely marked
- * const to discourage the caller from modifying anything there.
- */
-static inline struct stconn *cs_conn_get_first(const struct connection *conn)
-{
-       BUG_ON(!conn || !conn->mux);
-
-       if (!conn->mux->get_first_cs)
-               return NULL;
-       return conn->mux->get_first_cs(conn);
-}
-
-
 /* Returns non-zero if the stream connector's Rx path is blocked */
 static inline int cs_rx_blocked(const struct stconn *cs)
 {
index 30e689e1558deeb1bb979c8b07ecc82a4a050cf3..34d3f70d7d1ee19285a1aa3511cd5f2c4d0ac0e0 100644 (file)
@@ -493,6 +493,24 @@ static inline int conn_install_mux(struct connection *conn, const struct mux_ops
        return ret;
 }
 
+/* Retrieves any valid stream connector from this connection, preferably the first
+ * valid one. The purpose is to be able to figure one other end of a private
+ * connection for purposes like source binding or proxy protocol header
+ * emission. In such cases, any stream connector is expected to be valid so the
+ * mux is encouraged to return the first one it finds. If the connection has
+ * no mux or the mux has no get_first_cs() method or the mux has no valid
+ * stream connector, NULL is returned. The output pointer is purposely marked
+ * const to discourage the caller from modifying anything there.
+ */
+static inline struct stconn *conn_get_first_sc(const struct connection *conn)
+{
+       BUG_ON(!conn || !conn->mux);
+
+       if (!conn->mux->get_first_cs)
+               return NULL;
+       return conn->mux->get_first_cs(conn);
+}
+
 int conn_update_alpn(struct connection *conn, const struct ist alpn, int force);
 
 static inline const char *conn_get_ctrl_name(const struct connection *conn)
index f3775e85f6d8558f703fb9a5c8c922a72beea77d..7ba4b17cd214be5d4d982e65923c97a6fbd26a56 100644 (file)
@@ -1176,7 +1176,7 @@ int conn_send_proxy(struct connection *conn, unsigned int flag)
                /* If there is no mux attached to the connection, it means the
                 * connection context is a stream connector.
                 */
-               cs = (conn->mux ? cs_conn_get_first(conn) : conn->ctx);
+               cs = conn->mux ? conn_get_first_sc(conn) : conn->ctx;
 
                /* The target server expects a PROXY line to be sent first.
                 * If the send_proxy_ofs is negative, it corresponds to the