]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: session: use the ALPN token and proxy mode to select the mux
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Sep 2017 04:59:55 +0000 (06:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:03:23 +0000 (18:03 +0100)
When an incoming connection is made on an HTTP mode frontend, the
session now looks up the mux to use based on the ALPN token and the
proxy mode. This will allow easier mux registration, and we don't
need to hard-code the mux_pt_ops anymore.

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

index fbb37904dcf3b11ad8db0e664d58c38b9cd4a266..8ba4fc632a40ad4da1b36f64d2c83b36e6ec0d08 100644 (file)
@@ -757,17 +757,17 @@ static inline const struct mux_ops *conn_find_best_mux(struct connection *conn,
 }
 
 /* finds the best mux for incoming connection <conn>, a proxy in and http mode
- * <mode>, and installs it on the connection for direction <dir> (MUX_INBOUND/
- * MUX_OUTBOUND). Returns < 0 on error.
+ * <mode>, and installs it on the connection for upper context <ctx>. Returns
+ * < 0 on error.
  */
-static inline int conn_install_best_mux(struct connection *conn, int mode, enum mux_dir dir)
+static inline int conn_install_best_mux(struct connection *conn, int mode, void *ctx)
 {
        const struct mux_ops *mux_ops;
 
        mux_ops = conn_find_best_mux(conn, mode);
        if (!mux_ops)
                return -1;
-       return conn_install_mux(conn, mux_ops, dir);
+       return conn_install_mux(conn, mux_ops, ctx);
 }
 
 #endif /* _PROTO_CONNECTION_H */
index b0bf453adab067189e37da2f76e24e9781cdd943..c68cec545f5461979f6711b081c3e2a9917d302f 100644 (file)
@@ -21,7 +21,6 @@
 #include <proto/connection.h>
 #include <proto/listener.h>
 #include <proto/log.h>
-#include <proto/mux_pt.h>
 #include <proto/proto_http.h>
 #include <proto/proxy.h>
 #include <proto/session.h>
@@ -407,7 +406,7 @@ static int conn_complete_session(struct connection *conn)
                goto fail;
 
        session_count_new(sess);
-       if (conn_install_mux(conn, &mux_pt_ops, NULL) < 0)
+       if (conn_install_best_mux(conn, sess->fe->mode == PR_MODE_HTTP, NULL) < 0)
                goto fail;
 
        /* the embryonic session's task is not needed anymore */