X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fconnection.c;h=743553b96d0a4d6c0aeec942640c77c17218d97b;hb=fbd8a4e0144aa7777bedcd8c05daec61d594634d;hp=f76d71581f07a9080ab8837458c1b5d9cb08d0c1;hpb=57952005b6a6a0aeb1e4ecb0d7ac0c6786d23dba;p=babeltrace.git diff --git a/src/lib/graph/connection.c b/src/lib/graph/connection.c index f76d7158..743553b9 100644 --- a/src/lib/graph/connection.c +++ b/src/lib/graph/connection.c @@ -21,14 +21,16 @@ * SOFTWARE. */ -#define BT_LOG_TAG "CONNECTION" -#include "lib/lib-logging.h" +#define BT_LOG_TAG "LIB/CONNECTION" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" +#include "lib/assert-post.h" #include #include "lib/object.h" #include "compat/compiler.h" +#include #include #include @@ -44,13 +46,12 @@ void destroy_connection(struct bt_object *obj) struct bt_connection *connection = container_of(obj, struct bt_connection, base); - BT_LIB_LOGD("Destroying connection: %!+x", connection); + BT_LIB_LOGI("Destroying connection: %!+x", connection); /* * Make sure that each message iterator which was created for * this connection is finalized before we destroy it. Once a - * message iterator is finalized, all its method return NULL or - * the BT_MESSAGE_ITERATOR_STATUS_CANCELED status. + * message iterator is finalized, you cannot use it. * * Because connections are destroyed before components within a * graph, this ensures that message iterators are always @@ -120,12 +121,12 @@ struct bt_connection *bt_connection_create(struct bt_graph *graph, { struct bt_connection *connection = NULL; - BT_LIB_LOGD("Creating connection: " + BT_LIB_LOGI("Creating connection: " "%![graph-]+g, %![up-port-]+p, %![down-port-]+p", graph, upstream_port, downstream_port); connection = g_new0(struct bt_connection, 1); if (!connection) { - BT_LOGE_STR("Failed to allocate one connection."); + BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one connection."); goto end; } @@ -135,7 +136,7 @@ struct bt_connection *bt_connection_create(struct bt_graph *graph, parent_is_owner); connection->iterators = g_ptr_array_new(); if (!connection->iterators) { - BT_LOGE_STR("Failed to allocate a GPtrArray."); + BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray."); BT_OBJECT_PUT_REF_AND_RESET(connection); goto end; } @@ -149,7 +150,7 @@ struct bt_connection *bt_connection_create(struct bt_graph *graph, downstream_port); bt_port_set_connection(downstream_port, connection); bt_object_set_parent(&connection->base, &graph->base); - BT_LIB_LOGD("Created connection: %!+x", connection); + BT_LIB_LOGI("Created connection: %!+x", connection); end: return connection; @@ -162,7 +163,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) struct bt_port *upstream_port = conn->upstream_port; size_t i; - BT_LIB_LOGD("Ending connection: %!+x, try-remove-from-graph=%d", + BT_LIB_LOGI("Ending connection: %!+x, try-remove-from-graph=%d", conn, try_remove_from_graph); /* @@ -204,12 +205,12 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) * which is on graph destruction. */ for (i = 0; i < conn->iterators->len; i++) { - struct bt_self_component_port_input_message_iterator *iterator = + struct bt_message_iterator *iterator = g_ptr_array_index(conn->iterators, i); BT_LIB_LOGD("Finalizing message iterator created by " "this ended connection: %![iter-]+i", iterator); - bt_self_component_port_input_message_iterator_try_finalize( + bt_message_iterator_try_finalize( iterator); /* @@ -217,7 +218,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) * from this connection's iterators on destruction * because this connection won't exist anymore. */ - bt_self_component_port_input_message_iterator_set_connection( + bt_message_iterator_set_connection( iterator, NULL); } @@ -231,23 +232,23 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) const struct bt_port_output *bt_connection_borrow_upstream_port_const( const struct bt_connection *connection) { - BT_ASSERT_PRE_NON_NULL(connection, "Connection"); + BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection"); return (void *) connection->upstream_port; } const struct bt_port_input *bt_connection_borrow_downstream_port_const( const struct bt_connection *connection) { - BT_ASSERT_PRE_NON_NULL(connection, "Connection"); + BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection"); return (void *) connection->downstream_port; } BT_HIDDEN void bt_connection_remove_iterator(struct bt_connection *conn, - struct bt_self_component_port_input_message_iterator *iterator) + struct bt_message_iterator *iterator) { g_ptr_array_remove(conn->iterators, iterator); - BT_LIB_LOGV("Removed message iterator from connection: " + BT_LIB_LOGD("Removed message iterator from connection: " "%![conn-]+x, %![iter-]+i", conn, iterator); try_remove_connection_from_graph(conn); }