4 * Babeltrace Plugin Component Graph
6 * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 #define BT_LOG_TAG "GRAPH"
29 #include <babeltrace/lib-logging-internal.h>
31 #include <babeltrace/graph/component-internal.h>
32 #include <babeltrace/graph/graph-internal.h>
33 #include <babeltrace/graph/connection-internal.h>
34 #include <babeltrace/graph/component-sink-internal.h>
35 #include <babeltrace/graph/component-source.h>
36 #include <babeltrace/graph/component-filter.h>
37 #include <babeltrace/graph/port.h>
38 #include <babeltrace/compiler-internal.h>
39 #include <babeltrace/types.h>
43 struct bt_graph_listener
{
49 void bt_graph_destroy(struct bt_object
*obj
)
51 struct bt_graph
*graph
= container_of(obj
,
52 struct bt_graph
, base
);
55 * The graph's reference count is 0 if we're here. Increment
56 * it to avoid a double-destroy (possibly infinitely recursive)
59 * 1. We put and destroy a connection.
60 * 2. This connection's destructor finalizes its active
61 * notification iterators.
62 * 3. A notification iterator's finalization function gets a
63 * new reference on its component (reference count goes from
65 * 4. Since this component's reference count goes to 1, it takes
66 * a reference on its parent (this graph). This graph's
67 * reference count goes from 0 to 1.
68 * 5. The notification iterator's finalization function puts its
69 * component reference (reference count goes from 1 to 0).
70 * 6. Since this component's reference count goes from 1 to 0,
71 * it puts its parent (this graph). This graph's reference
72 * count goes from 1 to 0.
73 * 7. Since this graph's reference count goes from 1 to 0,
74 * its destructor is called (this function).
76 * With the incrementation below, the graph's reference count at
77 * step 4 goes from 1 to 2, and from 2 to 1 at step 6. This
78 * ensures that this function is not called two times.
80 BT_LOGD("Destroying graph: addr=%p", graph
);
81 obj
->ref_count
.count
++;
84 * Cancel the graph to disallow some operations, like creating
85 * notification iterators and adding ports to components.
87 (void) bt_graph_cancel(graph
);
89 if (graph
->connections
) {
90 BT_LOGD_STR("Destroying connections.");
91 g_ptr_array_free(graph
->connections
, TRUE
);
93 if (graph
->components
) {
94 BT_LOGD_STR("Destroying components.");
95 g_ptr_array_free(graph
->components
, TRUE
);
97 if (graph
->sinks_to_consume
) {
98 g_queue_free(graph
->sinks_to_consume
);
101 if (graph
->listeners
.port_added
) {
102 g_array_free(graph
->listeners
.port_added
, TRUE
);
105 if (graph
->listeners
.port_removed
) {
106 g_array_free(graph
->listeners
.port_removed
, TRUE
);
109 if (graph
->listeners
.ports_connected
) {
110 g_array_free(graph
->listeners
.ports_connected
, TRUE
);
113 if (graph
->listeners
.ports_disconnected
) {
114 g_array_free(graph
->listeners
.ports_disconnected
, TRUE
);
121 int init_listeners_array(GArray
**listeners
)
126 *listeners
= g_array_new(FALSE
, TRUE
, sizeof(struct bt_graph_listener
));
128 BT_LOGE_STR("Failed to allocate one GArray.");
137 struct bt_graph
*bt_graph_create(void)
139 struct bt_graph
*graph
;
142 BT_LOGD_STR("Creating graph object.");
143 graph
= g_new0(struct bt_graph
, 1);
145 BT_LOGE_STR("Failed to allocate one graph.");
149 bt_object_init(graph
, bt_graph_destroy
);
151 graph
->connections
= g_ptr_array_new_with_free_func(bt_object_release
);
152 if (!graph
->connections
) {
153 BT_LOGE_STR("Failed to allocate one GPtrArray.");
156 graph
->components
= g_ptr_array_new_with_free_func(bt_object_release
);
157 if (!graph
->components
) {
158 BT_LOGE_STR("Failed to allocate one GPtrArray.");
161 graph
->sinks_to_consume
= g_queue_new();
162 if (!graph
->sinks_to_consume
) {
163 BT_LOGE_STR("Failed to allocate one GQueue.");
167 ret
= init_listeners_array(&graph
->listeners
.port_added
);
169 BT_LOGE_STR("Cannot create the \"port added\" listener array.");
173 ret
= init_listeners_array(&graph
->listeners
.port_removed
);
175 BT_LOGE_STR("Cannot create the \"port removed\" listener array.");
179 ret
= init_listeners_array(&graph
->listeners
.ports_connected
);
181 BT_LOGE_STR("Cannot create the \"port connected\" listener array.");
185 ret
= init_listeners_array(&graph
->listeners
.ports_disconnected
);
187 BT_LOGE_STR("Cannot create the \"port disconneted\" listener array.");
191 BT_LOGD("Created graph object: addr=%p", graph
);
200 enum bt_graph_status
bt_graph_connect_ports(struct bt_graph
*graph
,
201 struct bt_port
*upstream_port
, struct bt_port
*downstream_port
,
202 struct bt_connection
**user_connection
)
204 enum bt_graph_status status
= BT_GRAPH_STATUS_OK
;
205 struct bt_connection
*connection
= NULL
;
206 struct bt_graph
*upstream_graph
= NULL
;
207 struct bt_graph
*downstream_graph
= NULL
;
208 struct bt_component
*upstream_component
= NULL
;
209 struct bt_component
*downstream_component
= NULL
;
210 enum bt_component_status component_status
;
211 bt_bool upstream_was_already_in_graph
;
212 bt_bool downstream_was_already_in_graph
;
215 BT_LOGW_STR("Invalid parameter: graph is NULL.");
216 status
= BT_GRAPH_STATUS_INVALID
;
220 if (!upstream_port
) {
221 BT_LOGW_STR("Invalid parameter: upstream port is NULL.");
222 status
= BT_GRAPH_STATUS_INVALID
;
226 if (!downstream_port
) {
227 BT_LOGW_STR("Invalid parameter: downstream port is NULL.");
228 status
= BT_GRAPH_STATUS_INVALID
;
232 BT_LOGD("Connecting component ports within graph: "
234 "upstream-port-addr=%p, upstream-port-name=\"%s\", "
235 "downstream-port-addr=%p, downstream-port-name=\"%s\"",
236 graph
, upstream_port
, bt_port_get_name(upstream_port
),
237 downstream_port
, bt_port_get_name(downstream_port
));
239 if (graph
->canceled
) {
240 BT_LOGW_STR("Invalid parameter: graph is canceled.");
241 status
= BT_GRAPH_STATUS_CANCELED
;
245 /* Ensure appropriate types for upstream and downstream ports. */
246 if (bt_port_get_type(upstream_port
) != BT_PORT_TYPE_OUTPUT
) {
247 BT_LOGW_STR("Invalid parameter: upstream port is not an output port.");
248 status
= BT_GRAPH_STATUS_INVALID
;
251 if (bt_port_get_type(downstream_port
) != BT_PORT_TYPE_INPUT
) {
252 BT_LOGW_STR("Invalid parameter: downstream port is not an input port.");
253 status
= BT_GRAPH_STATUS_INVALID
;
257 /* Ensure that both ports are currently unconnected. */
258 if (bt_port_is_connected(upstream_port
)) {
259 BT_LOGW_STR("Invalid parameter: upstream port is already connected.");
260 status
= BT_GRAPH_STATUS_INVALID
;
264 if (bt_port_is_connected(downstream_port
)) {
265 BT_LOGW_STR("Invalid parameter: downstream port is already connected.");
266 status
= BT_GRAPH_STATUS_INVALID
;
271 * Ensure that both ports are still attached to their creating
274 upstream_component
= bt_port_get_component(upstream_port
);
275 if (!upstream_component
) {
276 BT_LOGW_STR("Invalid parameter: upstream port is loose (does not belong to a component)");
277 status
= BT_GRAPH_STATUS_INVALID
;
281 downstream_component
= bt_port_get_component(downstream_port
);
282 if (!downstream_component
) {
283 BT_LOGW_STR("Invalid parameter: downstream port is loose (does not belong to a component)");
284 status
= BT_GRAPH_STATUS_INVALID
;
288 BT_LOGD("Connecting component ports: "
289 "upstream-comp-addr=%p, upstream-comp-name=\"%s\", "
290 "downstream-comp-addr=%p, downstream-comp-name=\"%s\"",
291 upstream_component
, bt_component_get_name(upstream_component
),
292 downstream_component
, bt_component_get_name(downstream_component
));
294 /* Ensure the components are not already part of another graph. */
295 upstream_graph
= bt_component_get_graph(upstream_component
);
296 if (upstream_graph
&& (graph
!= upstream_graph
)) {
297 BT_LOGW("Invalid parameter: upstream port's component is already part of another graph: "
298 "other-graph-addr=%p", upstream_graph
);
299 status
= BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH
;
302 upstream_was_already_in_graph
= (graph
== upstream_graph
);
303 downstream_graph
= bt_component_get_graph(downstream_component
);
304 if (downstream_graph
&& (graph
!= downstream_graph
)) {
305 BT_LOGW("Invalid parameter: downstream port's component is already part of another graph: "
306 "other-graph-addr=%p", downstream_graph
);
307 status
= BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH
;
310 downstream_was_already_in_graph
= (graph
== downstream_graph
);
313 * At this point the ports are not connected yet. Both
314 * components need to accept an eventual connection to their
315 * port by the other port before we continue.
317 BT_LOGD_STR("Asking upstream component to accept the connection.");
318 component_status
= bt_component_accept_port_connection(
319 upstream_component
, upstream_port
, downstream_port
);
320 if (component_status
!= BT_COMPONENT_STATUS_OK
) {
321 if (component_status
== BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION
) {
322 BT_LOGD_STR("Upstream component refused the connection.");
324 BT_LOGW("Cannot ask upstream component to accept the connection: "
325 "status=%s", bt_component_status_string(component_status
));
328 status
= bt_graph_status_from_component_status(
333 BT_LOGD_STR("Asking downstream component to accept the connection.");
334 component_status
= bt_component_accept_port_connection(
335 downstream_component
, downstream_port
, upstream_port
);
336 if (component_status
!= BT_COMPONENT_STATUS_OK
) {
337 if (component_status
== BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION
) {
338 BT_LOGD_STR("Downstream component refused the connection.");
340 BT_LOGW("Cannot ask downstream component to accept the connection: "
341 "status=%s", bt_component_status_string(component_status
));
344 status
= bt_graph_status_from_component_status(
349 BT_LOGD_STR("Creating connection.");
350 connection
= bt_connection_create(graph
, upstream_port
,
353 BT_LOGW("Cannot create connection object.");
354 status
= BT_GRAPH_STATUS_NOMEM
;
358 BT_LOGD("Connection object created: conn-addr=%p", connection
);
361 * Ownership of upstream_component/downstream_component and of
362 * the connection object is transferred to the graph.
364 g_ptr_array_add(graph
->connections
, connection
);
366 if (!upstream_was_already_in_graph
) {
367 g_ptr_array_add(graph
->components
, upstream_component
);
368 bt_component_set_graph(upstream_component
, graph
);
370 if (!downstream_was_already_in_graph
) {
371 g_ptr_array_add(graph
->components
, downstream_component
);
372 bt_component_set_graph(downstream_component
, graph
);
373 if (bt_component_get_class_type(downstream_component
) ==
374 BT_COMPONENT_CLASS_TYPE_SINK
) {
375 g_queue_push_tail(graph
->sinks_to_consume
,
376 downstream_component
);
381 * The graph is now the parent of these components which
382 * garantees their existence for the duration of the graph's
387 * Notify both components that their port is connected.
389 BT_LOGD_STR("Notifying upstream component that its port is connected.");
390 bt_component_port_connected(upstream_component
, upstream_port
,
392 BT_LOGD_STR("Notifying downstream component that its port is connected.");
393 bt_component_port_connected(downstream_component
, downstream_port
,
397 * Notify the graph's creator that both ports are connected.
399 BT_LOGD_STR("Notifying graph's user that new component ports are connected.");
400 bt_graph_notify_ports_connected(graph
, upstream_port
, downstream_port
);
401 BT_LOGD("Connected component ports within graph: "
403 "upstream-comp-addr=%p, upstream-comp-name=\"%s\", "
404 "downstream-comp-addr=%p, downstream-comp-name=\"%s\", "
405 "upstream-port-addr=%p, upstream-port-name=\"%s\", "
406 "downstream-port-addr=%p, downstream-port-name=\"%s\"",
408 upstream_component
, bt_component_get_name(upstream_component
),
409 downstream_component
, bt_component_get_name(downstream_component
),
410 upstream_port
, bt_port_get_name(upstream_port
),
411 downstream_port
, bt_port_get_name(downstream_port
));
413 if (user_connection
) {
414 /* Move reference to user */
415 *user_connection
= connection
;
420 bt_put(upstream_graph
);
421 bt_put(downstream_graph
);
422 bt_put(upstream_component
);
423 bt_put(downstream_component
);
429 enum bt_graph_status
bt_graph_consume_no_check(struct bt_graph
*graph
)
431 struct bt_component
*sink
;
432 enum bt_graph_status status
= BT_GRAPH_STATUS_OK
;
433 enum bt_component_status comp_status
;
436 BT_LOGV("Making next sink consume: addr=%p", graph
);
438 if (g_queue_is_empty(graph
->sinks_to_consume
)) {
439 BT_LOGV_STR("Graph's sink queue is empty: end of graph.");
440 status
= BT_GRAPH_STATUS_END
;
444 current_node
= g_queue_pop_head_link(graph
->sinks_to_consume
);
445 sink
= current_node
->data
;
446 BT_LOGV("Chose next sink to consume: comp-addr=%p, comp-name=\"%s\"",
447 sink
, bt_component_get_name(sink
));
448 comp_status
= bt_component_sink_consume(sink
);
449 BT_LOGV("Consumed from sink: status=%s",
450 bt_component_status_string(comp_status
));
451 switch (comp_status
) {
452 case BT_COMPONENT_STATUS_OK
:
454 case BT_COMPONENT_STATUS_END
:
455 status
= BT_GRAPH_STATUS_END
;
457 case BT_COMPONENT_STATUS_AGAIN
:
458 status
= BT_GRAPH_STATUS_AGAIN
;
460 case BT_COMPONENT_STATUS_INVALID
:
461 status
= BT_GRAPH_STATUS_INVALID
;
464 status
= BT_GRAPH_STATUS_ERROR
;
468 if (status
!= BT_GRAPH_STATUS_END
) {
469 g_queue_push_tail_link(graph
->sinks_to_consume
, current_node
);
473 /* End reached, the node is not added back to the queue and free'd. */
474 g_queue_delete_link(graph
->sinks_to_consume
, current_node
);
476 /* Don't forward an END status if there are sinks left to consume. */
477 if (!g_queue_is_empty(graph
->sinks_to_consume
)) {
478 status
= BT_GRAPH_STATUS_OK
;
482 BT_LOGV("Graph consumed: status=%s", bt_graph_status_string(status
));
486 enum bt_graph_status
bt_graph_consume(struct bt_graph
*graph
)
488 enum bt_graph_status status
= BT_GRAPH_STATUS_OK
;
491 BT_LOGW_STR("Invalid parameter: graph is NULL.");
492 status
= BT_GRAPH_STATUS_INVALID
;
496 if (graph
->canceled
) {
497 BT_LOGW("Invalid parameter: graph is canceled: "
498 "graph-addr=%p", graph
);
499 status
= BT_GRAPH_STATUS_CANCELED
;
503 status
= bt_graph_consume_no_check(graph
);
509 enum bt_graph_status
bt_graph_run(struct bt_graph
*graph
)
511 enum bt_graph_status status
= BT_GRAPH_STATUS_OK
;
514 BT_LOGW_STR("Invalid parameter: graph is NULL.");
515 status
= BT_GRAPH_STATUS_INVALID
;
519 if (graph
->canceled
) {
520 BT_LOGW("Invalid parameter: graph is canceled: "
521 "graph-addr=%p", graph
);
522 status
= BT_GRAPH_STATUS_CANCELED
;
526 BT_LOGV("Running graph: addr=%p", graph
);
530 * Check if the graph is canceled at each iteration. If
531 * the graph was canceled by another thread or by a
532 * signal, this is not a warning nor an error, it was
533 * intentional: log with a DEBUG level only.
535 if (graph
->canceled
) {
536 BT_LOGD("Stopping the graph: graph is canceled: "
537 "graph-addr=%p", graph
);
538 status
= BT_GRAPH_STATUS_CANCELED
;
542 status
= bt_graph_consume(graph
);
543 if (status
== BT_GRAPH_STATUS_AGAIN
) {
545 * If AGAIN is received and there are multiple
546 * sinks, go ahead and consume from the next
549 * However, in the case where a single sink is
550 * left, the caller can decide to busy-wait and
551 * call bt_graph_run() continuously until the
552 * source is ready or it can decide to sleep for
553 * an arbitrary amount of time.
555 if (graph
->sinks_to_consume
->length
> 1) {
556 status
= BT_GRAPH_STATUS_OK
;
559 } while (status
== BT_GRAPH_STATUS_OK
);
561 if (g_queue_is_empty(graph
->sinks_to_consume
)) {
562 status
= BT_GRAPH_STATUS_END
;
566 BT_LOGV("Graph ran: status=%s", bt_graph_status_string(status
));
571 int add_listener(GArray
*listeners
, void *func
, void *data
)
573 struct bt_graph_listener listener
= {
578 g_array_append_val(listeners
, listener
);
579 return listeners
->len
- 1;
582 int bt_graph_add_port_added_listener(
583 struct bt_graph
*graph
,
584 bt_graph_port_added_listener listener
, void *data
)
589 BT_LOGW_STR("Invalid parameter: graph is NULL.");
595 BT_LOGW_STR("Invalid parameter: listener is NULL.");
600 ret
= add_listener(graph
->listeners
.port_added
, listener
, data
);
601 BT_LOGV("Added \"port added\" listener to graph: "
602 "graph-addr=%p, listener-addr=%p, pos=%d",
603 graph
, listener
, ret
);
609 int bt_graph_add_port_removed_listener(
610 struct bt_graph
*graph
,
611 bt_graph_port_removed_listener listener
, void *data
)
616 BT_LOGW_STR("Invalid parameter: graph is NULL.");
622 BT_LOGW_STR("Invalid parameter: listener is NULL.");
627 ret
= add_listener(graph
->listeners
.port_removed
, listener
, data
);
628 BT_LOGV("Added \"port removed\" listener to graph: "
629 "graph-addr=%p, listener-addr=%p, pos=%d",
630 graph
, listener
, ret
);
636 int bt_graph_add_ports_connected_listener(
637 struct bt_graph
*graph
,
638 bt_graph_ports_connected_listener listener
, void *data
)
643 BT_LOGW_STR("Invalid parameter: graph is NULL.");
649 BT_LOGW_STR("Invalid parameter: listener is NULL.");
654 ret
= add_listener(graph
->listeners
.ports_connected
, listener
, data
);
655 BT_LOGV("Added \"port connected\" listener to graph: "
656 "graph-addr=%p, listener-addr=%p, pos=%d",
657 graph
, listener
, ret
);
663 int bt_graph_add_ports_disconnected_listener(
664 struct bt_graph
*graph
,
665 bt_graph_ports_disconnected_listener listener
, void *data
)
670 BT_LOGW_STR("Invalid parameter: graph is NULL.");
676 BT_LOGW_STR("Invalid parameter: listener is NULL.");
681 ret
= add_listener(graph
->listeners
.ports_disconnected
, listener
, data
);
682 BT_LOGV("Added \"port disconnected\" listener to graph: "
683 "graph-addr=%p, listener-addr=%p, pos=%d",
684 graph
, listener
, ret
);
691 void bt_graph_notify_port_added(struct bt_graph
*graph
, struct bt_port
*port
)
695 BT_LOGV("Notifying graph listeners that a port was added: "
696 "graph-addr=%p, port-addr=%p, port-name=\"%s\"",
697 graph
, port
, bt_port_get_name(port
));
699 for (i
= 0; i
< graph
->listeners
.port_added
->len
; i
++) {
700 struct bt_graph_listener listener
=
701 g_array_index(graph
->listeners
.port_added
,
702 struct bt_graph_listener
, i
);
703 bt_graph_port_added_listener func
= listener
.func
;
706 func(port
, listener
.data
);
711 void bt_graph_notify_port_removed(struct bt_graph
*graph
,
712 struct bt_component
*comp
, struct bt_port
*port
)
716 BT_LOGV("Notifying graph listeners that a port was removed: "
717 "graph-addr=%p, port-addr=%p, port-name=\"%s\"",
718 graph
, port
, bt_port_get_name(port
));
720 for (i
= 0; i
< graph
->listeners
.port_removed
->len
; i
++) {
721 struct bt_graph_listener listener
=
722 g_array_index(graph
->listeners
.port_removed
,
723 struct bt_graph_listener
, i
);
724 bt_graph_port_removed_listener func
= listener
.func
;
727 func(comp
, port
, listener
.data
);
732 void bt_graph_notify_ports_connected(struct bt_graph
*graph
,
733 struct bt_port
*upstream_port
, struct bt_port
*downstream_port
)
737 BT_LOGV("Notifying graph listeners that two ports were connected: "
739 "upstream-port-addr=%p, upstream-port-name=\"%s\", "
740 "downstream-port-addr=%p, downstream-port-name=\"%s\"",
741 graph
, upstream_port
, bt_port_get_name(upstream_port
),
742 downstream_port
, bt_port_get_name(downstream_port
));
744 for (i
= 0; i
< graph
->listeners
.ports_connected
->len
; i
++) {
745 struct bt_graph_listener listener
=
746 g_array_index(graph
->listeners
.ports_connected
,
747 struct bt_graph_listener
, i
);
748 bt_graph_ports_connected_listener func
= listener
.func
;
751 func(upstream_port
, downstream_port
, listener
.data
);
756 void bt_graph_notify_ports_disconnected(struct bt_graph
*graph
,
757 struct bt_component
*upstream_comp
,
758 struct bt_component
*downstream_comp
,
759 struct bt_port
*upstream_port
, struct bt_port
*downstream_port
)
763 BT_LOGV("Notifying graph listeners that two ports were disconnected: "
765 "upstream-port-addr=%p, upstream-port-name=\"%s\", "
766 "downstream-port-addr=%p, downstream-port-name=\"%s\"",
767 graph
, upstream_port
, bt_port_get_name(upstream_port
),
768 downstream_port
, bt_port_get_name(downstream_port
));
770 for (i
= 0; i
< graph
->listeners
.ports_disconnected
->len
; i
++) {
771 struct bt_graph_listener listener
=
772 g_array_index(graph
->listeners
.ports_disconnected
,
773 struct bt_graph_listener
, i
);
774 bt_graph_ports_disconnected_listener func
= listener
.func
;
777 func(upstream_comp
, downstream_comp
, upstream_port
,
778 downstream_port
, listener
.data
);
782 extern enum bt_graph_status
bt_graph_cancel(struct bt_graph
*graph
)
784 enum bt_graph_status ret
= BT_GRAPH_STATUS_OK
;
787 BT_LOGW_STR("Invalid parameter: graph is NULL.");
788 ret
= BT_GRAPH_STATUS_INVALID
;
792 graph
->canceled
= BT_TRUE
;
793 BT_LOGV("Canceled graph: addr=%p", graph
);
799 extern bt_bool
bt_graph_is_canceled(struct bt_graph
*graph
)
801 return graph
? graph
->canceled
: BT_FALSE
;
805 void bt_graph_remove_connection(struct bt_graph
*graph
,
806 struct bt_connection
*connection
)
810 BT_LOGV("Removing graph's connection: graph-addr=%p, conn-addr=%p",
812 g_ptr_array_remove(graph
->connections
, connection
);