int conn_upgrade_mux_fe(struct connection *conn, void *ctx, struct buffer *buf,
struct ist mux_proto, int mode);
int conn_install_mux_fe(struct connection *conn, void *ctx);
-int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess);
+int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess,
+ const struct mux_ops *force_mux_ops);
int conn_install_mux_chk(struct connection *conn, void *ctx, struct session *sess);
void conn_delete_from_tree(struct ebmb_node *node);
* fail, and flag the connection as CO_FL_ERROR.
*/
if (init_mux) {
- if (conn_install_mux_be(srv_conn, srv_cs, s->sess) < 0) {
+ if (conn_install_mux_be(srv_conn, srv_cs, s->sess, NULL) < 0) {
conn_full_close(srv_conn);
return SF_ERR_INTERNAL;
}
if (conn_install_mux_chk(conn, conn->ctx, sess) < 0)
goto fail;
}
- else if (conn_install_mux_be(conn, conn->ctx, sess) < 0)
+ else if (conn_install_mux_be(conn, conn->ctx, sess, NULL) < 0)
goto fail;
srv = objt_server(conn->target);
}
/* installs the best mux for outgoing connection <conn> using the upper context
- * <ctx>. If the mux protocol is forced, we use it to find the best mux. Returns
- * < 0 on error.
+ * <ctx>. If the server mux protocol is forced, we use it to find the best mux.
+ * It's also possible to specify an alternative mux protocol <force_mux_ops>,
+ * in which case it will be used instead of the default server mux protocol.
+ *
+ * Returns < 0 on error.
*/
-int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess)
+int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess,
+ const struct mux_ops *force_mux_ops)
{
struct server *srv = objt_server(conn->target);
struct proxy *prx = objt_proxy(conn->target);
if (!prx) // target must be either proxy or server
return -1;
- if (srv && srv->mux_proto)
+ if (srv && srv->mux_proto && likely(!force_mux_ops)) {
mux_ops = srv->mux_proto->mux;
+ }
+ else if (srv && unlikely(force_mux_ops)) {
+ mux_ops = force_mux_ops;
+ }
else {
struct ist mux_proto;
const char *alpn_str = NULL;