From: Philippe Proulx Date: Wed, 7 Jun 2017 15:52:37 +0000 (-0400) Subject: Add bt_connection_is_ended() X-Git-Tag: v2.0.0-pre1~48 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=090a4c0ac02fab83b9ad13bc2abb81534820f7f4;hp=fdf0e7a0859aac0e7a540ded801921bdb14cb450;p=babeltrace.git Add bt_connection_is_ended() Quickly indicates if a connection is ended without having to get and puts its individual endpoint ports. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/graph/connection.h b/include/babeltrace/graph/connection.h index 2d276fe3..60b9eef8 100644 --- a/include/babeltrace/graph/connection.h +++ b/include/babeltrace/graph/connection.h @@ -41,6 +41,8 @@ extern struct bt_port *bt_connection_get_downstream_port( extern struct bt_port *bt_connection_get_upstream_port( struct bt_connection *connection); +extern bt_bool bt_connection_is_ended(struct bt_connection *connection); + #ifdef __cplusplus } #endif diff --git a/lib/graph/connection.c b/lib/graph/connection.c index b0f64aeb..a13bce3e 100644 --- a/lib/graph/connection.c +++ b/lib/graph/connection.c @@ -402,3 +402,8 @@ void bt_connection_remove_iterator(struct bt_connection *conn, "conn-addr=%p, iter-addr=%p", conn, iterator); bt_connection_try_remove_from_graph(conn); } + +bt_bool bt_connection_is_ended(struct bt_connection *connection) +{ + return !connection->downstream_port && !connection->upstream_port; +}