- connection = bt_connection_from_private(private_connection);
- if (!connection->upstream_port || !connection->downstream_port) {
+ connection = bt_connection_borrow_from_private(private_connection);
+
+ if (bt_graph_is_canceled(bt_connection_borrow_graph(connection))) {
+ BT_LOGW("Cannot create notification iterator from connection: "
+ "connection's graph is canceled: "
+ "conn-addr=%p, upstream-port-addr=%p, "
+ "upstream-port-name=\"%s\", upstream-comp-addr=%p, "
+ "upstream-comp-name=\"%s\", graph-addr=%p",
+ connection, connection->upstream_port,
+ bt_port_get_name(connection->upstream_port),
+ upstream_component,
+ bt_component_get_name(upstream_component),
+ bt_connection_borrow_graph(connection));
+ status = BT_CONNECTION_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
+ if (bt_connection_is_ended(connection)) {