MEDIUM: session: make use of the connection's destroy callback

Now we don't remove the session when a stream dies, instead we
detach the stream and let the mux decide to release the connection
and call session_free() instead.
diff --git a/src/session.c b/src/session.c
index cbc8a5e..dc97544 100644
--- a/src/session.c
+++ b/src/session.c
@@ -73,6 +73,14 @@
 	HA_ATOMIC_SUB(&jobs, 1);
 }
 
+/* callback used from the connection/mux layer to notify that a connection is
+ * gonig to be released.
+ */
+void conn_session_free(struct connection *conn)
+{
+	session_free(conn->owner);
+}
+
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
 int init_session()
 {
@@ -415,6 +423,9 @@
 		task_free(sess->task);
 		sess->task = NULL;
 	}
+
+	conn_set_owner(conn, sess, conn_session_free);
+
 	return 0;
 
  fail: