/* Installs the connection's mux layer for upper context <ctx>.
* Returns < 0 on error.
*/
-static inline int conn_install_mux(struct connection *conn, const struct mux_ops *mux, void *ctx)
+static inline int conn_install_mux(struct connection *conn, const struct mux_ops *mux,
+ void *ctx, struct proxy *prx)
{
conn->mux = mux;
conn->mux_ctx = ctx;
- return mux->init ? mux->init(conn) : 0;
+ return mux->init ? mux->init(conn, prx) : 0;
}
/* returns a human-readable error code for conn->err_code, or NULL if the code
if (!mux_ops)
return -1;
}
- return conn_install_mux(conn, mux_ops, ctx);
+ return conn_install_mux(conn, mux_ops, ctx, bind_conf->frontend);
}
/* installs the best mux for outgoing connection <conn> using the upper context
if (!mux_ops)
return -1;
}
- return conn_install_mux(conn, mux_ops, ctx);
+ return conn_install_mux(conn, mux_ops, ctx, prx);
}
#endif /* _PROTO_CONNECTION_H */
struct connection;
struct conn_stream;
struct buffer;
+struct proxy;
struct server;
struct pipe;
* layer is not ready yet.
*/
struct mux_ops {
- int (*init)(struct connection *conn); /* early initialization */
+ int (*init)(struct connection *conn, struct proxy *prx); /* early initialization */
int (*wake)(struct connection *conn); /* mux-layer callback to report activity, mandatory */
void (*update_poll)(struct conn_stream *cs); /* commit cs flags to mux/conn */
size_t (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags); /* Called from the upper layer to get data */
clear_addr(&conn->addr.from);
conn_prepare(conn, proto, check->xprt);
- conn_install_mux(conn, &mux_pt_ops, cs);
+ conn_install_mux(conn, &mux_pt_ops, cs, s->proxy);
cs_attach(cs, check, &check_conn_cb);
/* only plain tcp-check supports quick ACK */
}
conn_prepare(conn, proto, xprt);
- conn_install_mux(conn, &mux_pt_ops, cs);
+ conn_install_mux(conn, &mux_pt_ops, cs, s->proxy);
cs_attach(cs, check, &check_conn_cb);
ret = SF_ERR_INTERNAL;
* connections from the fact that the context is still NULL. Returns < 0 on
* error.
*/
-static int h2_init(struct connection *conn)
+static int h2_init(struct connection *conn, struct proxy *prx)
{
if (conn->mux_ctx) {
/* we don't support outgoing connections for now */
* incoming ones, in which case one will be allocated and a new stream will be
* instanciated). Returns < 0 on error.
*/
-static int mux_pt_init(struct connection *conn)
+static int mux_pt_init(struct connection *conn, struct proxy *prx)
{
struct conn_stream *cs = conn->mux_ctx;
memcpy(&conn->addr.to, &peer->addr, sizeof(conn->addr.to));
conn_prepare(conn, peer->proto, peer->xprt);
- conn_install_mux(conn, &mux_pt_ops, cs);
+ conn_install_mux(conn, &mux_pt_ops, cs, s->be);
si_attach_cs(&s->si[1], cs);
s->do_log = NULL;