]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: make conn_si_send_proxy() use cs_get_first()
authorWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:38:19 +0000 (21:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:38:19 +0000 (21:38 +0100)
The function used to abuse the internals of mux_pt to retrieve a
conn_stream, which will not work anymore after the idle connection
changes. Let's make it rely on the more reliable cs_get_first()
instead.

src/stream_interface.c

index da8d2b1779be91ce9e40549f8d4a010287f81976..b7a0682e63fc75a72de30e7e4d25ff35e254f651 100644 (file)
@@ -329,10 +329,10 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
         * we've sent the whole proxy line. Otherwise we use connect().
         */
        while (conn->send_proxy_ofs) {
-               struct conn_stream *cs;
+               const struct conn_stream *cs;
                int ret;
 
-               cs = conn->mux_ctx;
+               cs = cs_get_first(conn);
                /* The target server expects a PROXY line to be sent first.
                 * If the send_proxy_ofs is negative, it corresponds to the
                 * offset to start sending from then end of the proxy string
@@ -342,7 +342,8 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
                 * is attached to a stream interface. Otherwise we can only
                 * send a LOCAL line (eg: for use with health checks).
                 */
-               if (conn->mux == &mux_pt_ops && cs->data_cb == &si_conn_cb) {
+
+               if (cs && cs->data_cb == &si_conn_cb) {
                        struct stream_interface *si = cs->data;
                        struct conn_stream *remote_cs = objt_cs(si_opposite(si)->end);
                        ret = make_proxy_line(trash.area, trash.size,