MEDIUM: mux: provide the session to the init() and attach() method.

Instead of trying to get the session from the connection, which is not
always there, and of course there could be multiple sessions per connection,
provide it with the init() and attach() methods, so that we know the
session for each outgoing stream.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 2cf37ab..7c8c164 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -816,11 +816,11 @@
  * Returns < 0 on error.
  */
 static inline int conn_install_mux(struct connection *conn, const struct mux_ops *mux,
-                                   void *ctx, struct proxy *prx)
+                                   void *ctx, struct proxy *prx, struct session *sess)
 {
 	conn->mux = mux;
 	conn->mux_ctx = ctx;
-	return mux->init ? mux->init(conn, prx) : 0;
+	return mux->init ? mux->init(conn, prx, sess) : 0;
 }
 
 /* returns a human-readable error code for conn->err_code, or NULL if the code
@@ -1093,14 +1093,14 @@
 		if (!mux_ops)
 			return -1;
 	}
-	return conn_install_mux(conn, mux_ops, ctx, bind_conf->frontend);
+	return conn_install_mux(conn, mux_ops, ctx, bind_conf->frontend, conn->owner);
 }
 
 /* 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.
  */
-static inline int conn_install_mux_be(struct connection *conn, void *ctx)
+static inline int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess)
 {
 	struct server *srv = objt_server(conn->target);
 	struct proxy  *prx = objt_proxy(conn->target);
@@ -1134,7 +1134,7 @@
 		if (!mux_ops)
 			return -1;
 	}
-	return conn_install_mux(conn, mux_ops, ctx, prx);
+	return conn_install_mux(conn, mux_ops, ctx, prx, sess);
 }
 
 #endif /* _PROTO_CONNECTION_H */
diff --git a/include/types/connection.h b/include/types/connection.h
index eff1001..d1819cc 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -44,6 +44,7 @@
 struct buffer;
 struct proxy;
 struct server;
+struct session;
 struct pipe;
 
 enum sub_event_type {
@@ -319,7 +320,7 @@
  * layer is not ready yet.
  */
 struct mux_ops {
-	int  (*init)(struct connection *conn, struct proxy *prx);  /* early initialization */
+	int  (*init)(struct connection *conn, struct proxy *prx, struct session *sess);  /* early initialization */
 	int  (*wake)(struct connection *conn);        /* mux-layer callback to report activity, mandatory */
 	size_t (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags); /* Called from the upper layer to get data */
 	size_t (*snd_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
@@ -328,7 +329,7 @@
 	void (*shutr)(struct conn_stream *cs, enum cs_shr_mode);     /* shutr function */
 	void (*shutw)(struct conn_stream *cs, enum cs_shw_mode);     /* shutw function */
 
-	struct conn_stream *(*attach)(struct connection *); /* Create and attach a conn_stream to an outgoing connection */
+	struct conn_stream *(*attach)(struct connection *, struct session *sess); /* Create and attach a conn_stream to an outgoing connection */
 	const struct conn_stream *(*get_first_cs)(const struct connection *); /* retrieves any valid conn_stream from this connection */
 	void (*detach)(struct conn_stream *); /* Detach a conn_stream from an outgoing connection, when the request is done */
 	void (*show_fd)(struct buffer *, struct connection *); /* append some data about connection into chunk for "show fd" */