+
+BT_HIDDEN
+enum bt_component_status lttng_live_accept_port_connection(
+ struct bt_private_component *private_component,
+ struct bt_private_port *self_private_port,
+ struct bt_port *other_port)
+{
+ struct lttng_live_component *lttng_live =
+ bt_private_component_get_user_data(private_component);
+ struct bt_component *other_component;
+ enum bt_component_status status = BT_COMPONENT_STATUS_OK;
+ struct bt_port *self_port = bt_port_from_private_port(self_private_port);
+
+ other_component = bt_port_get_component(other_port);
+ bt_put(other_component); /* weak */
+
+ if (!lttng_live->downstream_component) {
+ lttng_live->downstream_component = other_component;
+ goto end;
+ }
+
+ /*
+ * Compare prior component to ensure we are connected to the
+ * same downstream component as prior ports.
+ */
+ if (lttng_live->downstream_component != other_component) {
+ BT_LOGW("Cannot connect ctf.lttng-live component port \"%s\" to component \"%s\": already connected to component \"%s\".",
+ bt_port_get_name(self_port),
+ bt_component_get_name(other_component),
+ bt_component_get_name(lttng_live->downstream_component));
+ status = BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION;
+ goto end;
+ }
+end:
+ bt_put(self_port);
+ return status;
+}