lib: internal: graph.h: require logging and BT_ASSERT_{PRE,POST}()
[babeltrace.git] / src / lib / graph / graph.c
index 70d958fc196bd1924dd449a2334b985ff52d273e..62175cf98b8413eb59be2dd3b5399ac983ce0595 100644 (file)
  */
 
 #define BT_LOG_TAG "LIB/GRAPH"
-#include "lib/lib-logging.h"
+#include "lib/logging.h"
 
 #include "common/assert.h"
 #include "lib/assert-pre.h"
+#include "lib/assert-post.h"
 #include <babeltrace2/graph/graph.h>
 #include <babeltrace2/graph/graph-const.h>
 #include <babeltrace2/graph/component-source-const.h>
@@ -435,45 +436,6 @@ enum bt_graph_status bt_graph_connect_ports(
        downstream_component = bt_port_borrow_component_inline(
                (void *) downstream_port);
 
-       /*
-        * At this point the ports are not connected yet. Both
-        * components need to accept an eventual connection to their
-        * port by the other port before we continue.
-        */
-       BT_LIB_LOGD("Asking upstream component to accept the connection: "
-               "%![comp-]+c", upstream_component);
-       component_status = bt_component_accept_port_connection(
-               upstream_component, (void *) upstream_port,
-               (void *) downstream_port);
-       if (component_status != BT_SELF_COMPONENT_STATUS_OK) {
-               if (component_status == BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION) {
-                       BT_LOGD_STR("Upstream component refused the connection.");
-               } else {
-                       BT_LOGW("Cannot ask upstream component to accept the connection: "
-                               "status=%s", bt_self_component_status_string(component_status));
-               }
-
-               status = (int) component_status;
-               goto end;
-       }
-
-       BT_LIB_LOGD("Asking downstream component to accept the connection: "
-               "%![comp-]+c", downstream_component);
-       component_status = bt_component_accept_port_connection(
-               downstream_component, (void *) downstream_port,
-               (void *) upstream_port);
-       if (component_status != BT_SELF_COMPONENT_STATUS_OK) {
-               if (component_status == BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION) {
-                       BT_LOGD_STR("Downstream component refused the connection.");
-               } else {
-                       BT_LOGW("Cannot ask downstream component to accept the connection: "
-                               "status=%s", bt_self_component_status_string(component_status));
-               }
-
-               status = (int) component_status;
-               goto end;
-       }
-
        BT_LOGD_STR("Creating connection.");
        connection = bt_connection_create(graph, (void *) upstream_port,
                (void *) downstream_port);
@@ -577,7 +539,7 @@ enum bt_graph_status consume_graph_sink(struct bt_component_sink *comp)
        comp_status = sink_class->methods.consume((void *) comp);
        BT_LOGD("User method returned: status=%s",
                bt_self_component_status_string(comp_status));
-       BT_ASSERT_PRE(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
+       BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
                comp_status == BT_SELF_COMPONENT_STATUS_END ||
                comp_status == BT_SELF_COMPONENT_STATUS_AGAIN ||
                comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
This page took 0.025943 seconds and 4 git commands to generate.