From 2038affbfc70dbebc19cd8f3f6e2708259e8109d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 29 Mar 2017 02:27:53 -0400 Subject: [PATCH] Fix: call acting component's "port disconnected" method too MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When a port is disconnected, call both upstream and downstream components. It's okay to get notified as a component even if you caused this notification. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- include/babeltrace/graph/connection-internal.h | 3 +-- lib/component/component.c | 2 +- lib/component/connection.c | 7 +++---- lib/component/port.c | 2 +- lib/component/sink.c | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/babeltrace/graph/connection-internal.h b/include/babeltrace/graph/connection-internal.h index d22c7eea..ac75320d 100644 --- a/include/babeltrace/graph/connection-internal.h +++ b/include/babeltrace/graph/connection-internal.h @@ -70,7 +70,6 @@ struct bt_connection *bt_connection_create(struct bt_graph *graph, struct bt_port *downstream_port); BT_HIDDEN -void bt_connection_disconnect_ports(struct bt_connection *conn, - struct bt_component *comp); +void bt_connection_disconnect_ports(struct bt_connection *conn); #endif /* BABELTRACE_COMPONENT_CONNECTION_INTERNAL_H */ diff --git a/lib/component/component.c b/lib/component/component.c index e8c4b5af..47f83c86 100644 --- a/lib/component/component.c +++ b/lib/component/component.c @@ -477,7 +477,7 @@ void bt_component_remove_port_at_index(struct bt_component *component, /* Disconnect both ports of this port's connection, if any */ if (port->connection) { - bt_connection_disconnect_ports(port->connection, component); + bt_connection_disconnect_ports(port->connection); } /* Remove from parent's array of ports (weak refs) */ diff --git a/lib/component/connection.c b/lib/component/connection.c index d57a2cd4..5075c309 100644 --- a/lib/component/connection.c +++ b/lib/component/connection.c @@ -89,8 +89,7 @@ end: } BT_HIDDEN -void bt_connection_disconnect_ports(struct bt_connection *conn, - struct bt_component *acting_comp) +void bt_connection_disconnect_ports(struct bt_connection *conn) { struct bt_component *downstream_comp = NULL; struct bt_component *upstream_comp = NULL; @@ -109,12 +108,12 @@ void bt_connection_disconnect_ports(struct bt_connection *conn, conn->upstream_port = NULL; } - if (downstream_comp && downstream_comp != acting_comp) { + if (downstream_comp) { bt_component_port_disconnected(downstream_comp, downstream_port); } - if (upstream_comp && upstream_comp != acting_comp) { + if (upstream_comp) { bt_component_port_disconnected(upstream_comp, upstream_port); } diff --git a/lib/component/port.c b/lib/component/port.c index 68b1cb60..f1c5d175 100644 --- a/lib/component/port.c +++ b/lib/component/port.c @@ -166,7 +166,7 @@ int bt_port_disconnect(struct bt_port *port) } if (port->connection) { - bt_connection_disconnect_ports(port->connection, NULL); + bt_connection_disconnect_ports(port->connection); } end: diff --git a/lib/component/sink.c b/lib/component/sink.c index 1f01d319..fbdb3a3e 100644 --- a/lib/component/sink.c +++ b/lib/component/sink.c @@ -162,7 +162,7 @@ bt_private_component_sink_get_input_private_port_at_index( bt_component_from_private(private_component), index)); } -struct bt_private_port *bt_private_component_sink_get_default_private_input_port( +struct bt_private_port *bt_private_component_sink_get_default_input_private_port( struct bt_private_component *private_component) { return bt_private_port_from_port( -- 2.34.1