From c594ab036e1797da45594dce8dfc07d90f2bb81f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 19 Jun 2019 16:22:54 -0400 Subject: [PATCH] lib: remove "accept port" concept This patch removes the concept of a component needing to accept a port connection before a connection is made. Since the component connections are supposed to be transparent (a component behavior shouldn't change based on which component is on the other side), there is no point in letting a component refuse a connection. Refusing a port connection based on the component class, for example, could lead to tightly coupled components, which we want to avoid. Change-Id: Ia2d0e09caaee069e9be22b8089ef5ccbae392bb2 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1522 Tested-by: jenkins Reviewed-by: Philippe Proulx --- .../graph/component-class-filter.h | 22 -- .../babeltrace2/graph/component-class-sink.h | 11 - .../graph/component-class-source.h | 11 - include/babeltrace2/graph/graph-const.h | 1 - include/babeltrace2/graph/self-component.h | 1 - include/babeltrace2/plugin/plugin-dev.h | 124 +--------- src/bindings/python/bt2/bt2/__init__.py.in | 4 - src/bindings/python/bt2/bt2/component.py | 23 -- src/bindings/python/bt2/bt2/graph.py | 4 +- .../python/bt2/bt2/native_bt_component.i | 1 - .../bt2/bt2/native_bt_component_class.i | 209 +---------------- src/bindings/python/bt2/bt2/native_bt_graph.i | 1 - src/cli/babeltrace2.c | 20 -- src/common/common.h | 2 - src/lib/graph/component-class.c | 56 ----- src/lib/graph/component-class.h | 4 - src/lib/graph/component.c | 77 ------- src/lib/graph/component.h | 5 - src/lib/graph/graph.c | 39 ---- src/lib/graph/graph.h | 2 - src/lib/plugin/plugin-so.c | 80 ------- tests/bindings/python/bt2/test_graph.py | 27 --- tests/lib/test_graph_topo.c | 214 +----------------- 23 files changed, 23 insertions(+), 915 deletions(-) diff --git a/include/babeltrace2/graph/component-class-filter.h b/include/babeltrace2/graph/component-class-filter.h index e516a288..af7fbf18 100644 --- a/include/babeltrace2/graph/component-class-filter.h +++ b/include/babeltrace2/graph/component-class-filter.h @@ -103,18 +103,6 @@ typedef bt_query_status const char *object, const bt_value *params, bt_logging_level logging_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_filter_accept_input_port_connection_method)( - bt_self_component_filter *self_component, - bt_self_component_port_input *self_port, - const bt_port_output *other_port); - -typedef bt_self_component_status -(*bt_component_class_filter_accept_output_port_connection_method)( - bt_self_component_filter *self_component, - bt_self_component_port_output *self_port, - const bt_port_input *other_port); - typedef bt_self_component_status (*bt_component_class_filter_input_port_connected_method)( bt_self_component_filter *self_component, @@ -149,16 +137,6 @@ bt_component_class_filter_set_finalize_method( bt_component_class_filter *comp_class, bt_component_class_filter_finalize_method method); -extern bt_component_class_status -bt_component_class_filter_set_accept_input_port_connection_method( - bt_component_class_filter *comp_class, - bt_component_class_filter_accept_input_port_connection_method method); - -extern bt_component_class_status -bt_component_class_filter_set_accept_output_port_connection_method( - bt_component_class_filter *comp_class, - bt_component_class_filter_accept_output_port_connection_method method); - extern bt_component_class_status bt_component_class_filter_set_input_port_connected_method( bt_component_class_filter *comp_class, diff --git a/include/babeltrace2/graph/component-class-sink.h b/include/babeltrace2/graph/component-class-sink.h index 6cee6726..f4b2bb8c 100644 --- a/include/babeltrace2/graph/component-class-sink.h +++ b/include/babeltrace2/graph/component-class-sink.h @@ -65,12 +65,6 @@ typedef bt_query_status bt_logging_level logging_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_sink_accept_input_port_connection_method)( - bt_self_component_sink *self_component, - bt_self_component_port_input *self_port, - const bt_port_output *other_port); - typedef bt_self_component_status (*bt_component_class_sink_input_port_connected_method)( bt_self_component_sink *self_component, @@ -104,11 +98,6 @@ extern bt_component_class_status bt_component_class_sink_set_finalize_method( bt_component_class_sink *comp_class, bt_component_class_sink_finalize_method method); -extern bt_component_class_status -bt_component_class_sink_set_accept_input_port_connection_method( - bt_component_class_sink *comp_class, - bt_component_class_sink_accept_input_port_connection_method method); - extern bt_component_class_status bt_component_class_sink_set_input_port_connected_method( bt_component_class_sink *comp_class, diff --git a/include/babeltrace2/graph/component-class-source.h b/include/babeltrace2/graph/component-class-source.h index 6536426a..05fb5a4b 100644 --- a/include/babeltrace2/graph/component-class-source.h +++ b/include/babeltrace2/graph/component-class-source.h @@ -103,12 +103,6 @@ typedef bt_query_status (*bt_component_class_source_query_method)( bt_logging_level logging_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_source_accept_output_port_connection_method)( - bt_self_component_source *self_component, - bt_self_component_port_output *self_port, - const bt_port_input *other_port); - typedef bt_self_component_status (*bt_component_class_source_output_port_connected_method)( bt_self_component_source *self_component, @@ -137,11 +131,6 @@ bt_component_class_source_set_finalize_method( bt_component_class_source *comp_class, bt_component_class_source_finalize_method method); -extern bt_component_class_status -bt_component_class_source_set_accept_output_port_connection_method( - bt_component_class_source *comp_class, - bt_component_class_source_accept_output_port_connection_method method); - extern bt_component_class_status bt_component_class_source_set_output_port_connected_method( bt_component_class_source *comp_class, diff --git a/include/babeltrace2/graph/graph-const.h b/include/babeltrace2/graph/graph-const.h index c2dd64cd..97672b7b 100644 --- a/include/babeltrace2/graph/graph-const.h +++ b/include/babeltrace2/graph/graph-const.h @@ -35,7 +35,6 @@ typedef enum bt_graph_status { BT_GRAPH_STATUS_OK = 0, BT_GRAPH_STATUS_END = 1, BT_GRAPH_STATUS_AGAIN = 11, - BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111, BT_GRAPH_STATUS_CANCELED = 125, BT_GRAPH_STATUS_ERROR = -1, BT_GRAPH_STATUS_NOMEM = -12, diff --git a/include/babeltrace2/graph/self-component.h b/include/babeltrace2/graph/self-component.h index fe4e4df5..4d53697f 100644 --- a/include/babeltrace2/graph/self-component.h +++ b/include/babeltrace2/graph/self-component.h @@ -34,7 +34,6 @@ typedef enum bt_self_component_status { BT_SELF_COMPONENT_STATUS_OK = 0, BT_SELF_COMPONENT_STATUS_END = 1, BT_SELF_COMPONENT_STATUS_AGAIN = 11, - BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111, BT_SELF_COMPONENT_STATUS_ERROR = -1, BT_SELF_COMPONENT_STATUS_NOMEM = -12, } bt_self_component_status; diff --git a/include/babeltrace2/plugin/plugin-dev.h b/include/babeltrace2/plugin/plugin-dev.h index 5f7d2826..b266a92b 100644 --- a/include/babeltrace2/plugin/plugin-dev.h +++ b/include/babeltrace2/plugin/plugin-dev.h @@ -180,17 +180,15 @@ enum __bt_plugin_component_class_descriptor_attribute_type { BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD = 2, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FINALIZE_METHOD = 3, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD = 4, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_INPUT_PORT_CONNECTION_METHOD = 5, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD = 6, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INPUT_PORT_CONNECTED_METHOD = 7, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_OUTPUT_PORT_CONNECTED_METHOD = 8, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_GRAPH_IS_CONFIGURED_METHOD = 9, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD = 10, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD = 11, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_SEEK_NS_FROM_ORIGIN_METHOD = 12, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_SEEK_BEGINNING_METHOD = 13, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_CAN_SEEK_NS_FROM_ORIGIN_METHOD = 14, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_CAN_SEEK_BEGINNING_METHOD = 15, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INPUT_PORT_CONNECTED_METHOD = 5, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_OUTPUT_PORT_CONNECTED_METHOD = 6, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_GRAPH_IS_CONFIGURED_METHOD = 7, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD = 8, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD = 9, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_SEEK_NS_FROM_ORIGIN_METHOD = 10, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_SEEK_BEGINNING_METHOD = 11, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_CAN_SEEK_NS_FROM_ORIGIN_METHOD = 12, + BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_CAN_SEEK_BEGINNING_METHOD = 13, }; /* Component class attribute (internal use) */ @@ -230,14 +228,6 @@ struct __bt_plugin_component_class_descriptor_attribute { bt_component_class_filter_query_method filter_query_method; bt_component_class_sink_query_method sink_query_method; - /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_INPUT_PORT_CONNECTION_METHOD */ - bt_component_class_filter_accept_input_port_connection_method filter_accept_input_port_connection_method; - bt_component_class_sink_accept_input_port_connection_method sink_accept_input_port_connection_method; - - /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD */ - bt_component_class_source_accept_output_port_connection_method source_accept_output_port_connection_method; - bt_component_class_filter_accept_output_port_connection_method filter_accept_output_port_connection_method; - /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INPUT_PORT_CONNECTED_METHOD */ bt_component_class_filter_input_port_connected_method filter_input_port_connected_method; bt_component_class_sink_input_port_connected_method sink_input_port_connected_method; @@ -776,54 +766,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(sink_query_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD, _id, _comp_class_id, sink, _x) -/* - * Defines an accept input port connection method attribute attached to - * a specific filter component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Accept port connection method - * (bt_component_class_filter_accept_input_port_connection_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_accept_input_port_connection_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_INPUT_PORT_CONNECTION_METHOD, _id, _comp_class_id, filter, _x) - -/* - * Defines an accept input port connection method attribute attached to - * a specific sink component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Accept port connection method - * (bt_component_class_sink_accept_input_port_connection_method). - */ -#define BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(sink_accept_input_port_connection_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_INPUT_PORT_CONNECTION_METHOD, _id, _comp_class_id, sink, _x) - -/* - * Defines an accept output port connection method attribute attached to - * a specific source component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Accept port connection method - * (bt_component_class_source_accept_output_port_connection_method). - */ -#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_accept_output_port_connection_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD, _id, _comp_class_id, source, _x) - -/* - * Defines an accept output port connection method attribute attached to - * a specific filter component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Accept port connection method - * (bt_component_class_filter_accept_output_port_connection_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_accept_output_port_connection_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD, _id, _comp_class_id, filter, _x) - /* * Defines an input port connected method attribute attached to a * specific filter component class descriptor. @@ -1280,54 +1222,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD(_name, _x) \ BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(auto, _name, _x) -/* - * Defines an accept input port connection method attribute attached to - * a filter component class descriptor which is attached to the - * automatic plugin descriptor. - * - * _name: Component class name (C identifier). - * _x: Accept port connection method - * (bt_component_class_filter_accept_input_port_connection_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD(_name, _x) \ - BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD_WITH_ID(auto, _name, _x) - -/* - * Defines an accept input port connection method attribute attached to - * a sink component class descriptor which is attached to the automatic - * plugin descriptor. - * - * _name: Component class name (C identifier). - * _x: Accept port connection method - * (bt_component_class_sink_accept_input_port_connection_method). - */ -#define BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD(_name, _x) \ - BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_INPUT_PORT_CONNECTION_METHOD_WITH_ID(auto, _name, _x) - -/* - * Defines an accept output port connection method attribute attached to - * a source component class descriptor which is attached to the - * automatic plugin descriptor. - * - * _name: Component class name (C identifier). - * _x: Accept port connection method - * (bt_component_class_source_accept_output_port_connection_method). - */ -#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD(_name, _x) \ - BT_PLUGIN_SOURCE_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD_WITH_ID(auto, _name, _x) - -/* - * Defines an accept output port connection method attribute attached to - * a filter component class descriptor which is attached to the - * automatic plugin descriptor. - * - * _name: Component class name (C identifier). - * _x: Accept port connection method - * (bt_component_class_filter_accept_output_port_connection_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD(_name, _x) \ - BT_PLUGIN_FILTER_COMPONENT_CLASS_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD_WITH_ID(auto, _name, _x) - /* * Defines an input port connected method attribute attached to a filter * component class descriptor which is attached to the automatic plugin diff --git a/src/bindings/python/bt2/bt2/__init__.py.in b/src/bindings/python/bt2/bt2/__init__.py.in index 1bebfd4e..fe987a3d 100644 --- a/src/bindings/python/bt2/bt2/__init__.py.in +++ b/src/bindings/python/bt2/bt2/__init__.py.in @@ -90,10 +90,6 @@ class Stop(StopIteration): pass -class PortConnectionRefused(Exception): - pass - - class IncompleteUserClass(Error): pass diff --git a/src/bindings/python/bt2/bt2/component.py b/src/bindings/python/bt2/bt2/component.py index b2edd34e..7f56757d 100644 --- a/src/bindings/python/bt2/bt2/component.py +++ b/src/bindings/python/bt2/bt2/component.py @@ -100,8 +100,6 @@ def _handle_component_status(status, gen_error_msg): raise bt2.Stop elif status == native_bt.SELF_COMPONENT_STATUS_AGAIN: raise bt2.TryAgain - elif status == native_bt.SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION: - raise bt2.PortConnectionRefused elif status < 0: raise bt2.Error(gen_error_msg) @@ -602,27 +600,6 @@ class _UserComponent(metaclass=_UserComponentType): def _finalize(self): pass - def _accept_port_connection(self, port, other_port): - return True - - def _accept_port_connection_from_native(self, self_port_ptr, self_port_type, other_port_ptr): - port = bt2.port._create_self_from_ptr_and_get_ref( - self_port_ptr, self_port_type) - - if self_port_type == native_bt.PORT_TYPE_OUTPUT: - other_port_type = native_bt.PORT_TYPE_INPUT - else: - other_port_type = native_bt.PORT_TYPE_OUTPUT - - other_port = bt2.port._create_from_ptr_and_get_ref( - other_port_ptr, other_port_type) - res = self._accept_port_connection(port, other_port_ptr) - - if type(res) is not bool: - raise TypeError("'{}' is not a 'bool' object") - - return res - def _port_connected(self, port, other_port): pass diff --git a/src/bindings/python/bt2/bt2/graph.py b/src/bindings/python/bt2/bt2/graph.py index 849b208a..f1270b5a 100644 --- a/src/bindings/python/bt2/bt2/graph.py +++ b/src/bindings/python/bt2/bt2/graph.py @@ -66,9 +66,7 @@ class Graph(object._SharedObject): super().__init__(ptr) def _handle_status(self, status, gen_error_msg): - if status == native_bt.GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION: - raise bt2.PortConnectionRefused - elif status == native_bt.GRAPH_STATUS_CANCELED: + if status == native_bt.GRAPH_STATUS_CANCELED: raise bt2.GraphCanceled elif status == native_bt.GRAPH_STATUS_END: raise bt2.Stop diff --git a/src/bindings/python/bt2/bt2/native_bt_component.i b/src/bindings/python/bt2/bt2/native_bt_component.i index 9eb946e8..e663c722 100644 --- a/src/bindings/python/bt2/bt2/native_bt_component.i +++ b/src/bindings/python/bt2/bt2/native_bt_component.i @@ -203,7 +203,6 @@ typedef enum bt_self_component_status { BT_SELF_COMPONENT_STATUS_OK = 0, BT_SELF_COMPONENT_STATUS_END = 1, BT_SELF_COMPONENT_STATUS_AGAIN = 11, - BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111, BT_SELF_COMPONENT_STATUS_ERROR = -1, BT_SELF_COMPONENT_STATUS_NOMEM = -12, } bt_self_component_status; diff --git a/src/bindings/python/bt2/bt2/native_bt_component_class.i b/src/bindings/python/bt2/bt2/native_bt_component_class.i index 522990a2..6deb22ef 100644 --- a/src/bindings/python/bt2/bt2/native_bt_component_class.i +++ b/src/bindings/python/bt2/bt2/native_bt_component_class.i @@ -125,12 +125,6 @@ typedef bt_query_status (*bt_component_class_source_query_method)( bt_logging_level log_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_source_accept_output_port_connection_method)( - bt_self_component_source *self_component, - bt_self_component_port_output *self_port, - const bt_port_input *other_port); - typedef bt_self_component_status (*bt_component_class_source_output_port_connected_method)( bt_self_component_source *self_component, @@ -155,11 +149,6 @@ bt_component_class_source_set_finalize_method( bt_component_class_source *comp_class, bt_component_class_source_finalize_method method); -extern bt_component_class_status -bt_component_class_source_set_accept_output_port_connection_method( - bt_component_class_source *comp_class, - bt_component_class_source_accept_output_port_connection_method method); - extern bt_component_class_status bt_component_class_source_set_output_port_connected_method( bt_component_class_source *comp_class, @@ -264,18 +253,6 @@ typedef bt_query_status bt_logging_level log_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_filter_accept_input_port_connection_method)( - bt_self_component_filter *self_component, - bt_self_component_port_input *self_port, - const bt_port_output *other_port); - -typedef bt_self_component_status -(*bt_component_class_filter_accept_output_port_connection_method)( - bt_self_component_filter *self_component, - bt_self_component_port_output *self_port, - const bt_port_input *other_port); - typedef bt_self_component_status (*bt_component_class_filter_input_port_connected_method)( bt_self_component_filter *self_component, @@ -306,16 +283,6 @@ bt_component_class_filter_set_finalize_method( bt_component_class_filter *comp_class, bt_component_class_filter_finalize_method method); -extern bt_component_class_status -bt_component_class_filter_set_accept_input_port_connection_method( - bt_component_class_filter *comp_class, - bt_component_class_filter_accept_input_port_connection_method method); - -extern bt_component_class_status -bt_component_class_filter_set_accept_output_port_connection_method( - bt_component_class_filter *comp_class, - bt_component_class_filter_accept_output_port_connection_method method); - extern bt_component_class_status bt_component_class_filter_set_input_port_connected_method( bt_component_class_filter *comp_class, @@ -390,12 +357,6 @@ typedef bt_query_status bt_logging_level log_level, const bt_value **result); -typedef bt_self_component_status -(*bt_component_class_sink_accept_input_port_connection_method)( - bt_self_component_sink *self_component, - bt_self_component_port_input *self_port, - const bt_port_output *other_port); - typedef bt_self_component_status (*bt_component_class_sink_input_port_connected_method)( bt_self_component_sink *self_component, @@ -425,11 +386,6 @@ extern bt_component_class_status bt_component_class_sink_set_finalize_method( bt_component_class_sink *comp_class, bt_component_class_sink_finalize_method method); -extern bt_component_class_status -bt_component_class_sink_set_accept_input_port_connection_method( - bt_component_class_sink *comp_class, - bt_component_class_sink_accept_input_port_connection_method method); - extern bt_component_class_status bt_component_class_sink_set_input_port_connected_method( bt_component_class_sink *comp_class, @@ -522,7 +478,6 @@ static PyObject *py_mod_bt2 = NULL; static PyObject *py_mod_bt2_exc_error_type = NULL; static PyObject *py_mod_bt2_exc_try_again_type = NULL; static PyObject *py_mod_bt2_exc_stop_type = NULL; -static PyObject *py_mod_bt2_exc_port_connection_refused_type = NULL; static PyObject *py_mod_bt2_exc_msg_iter_canceled_type = NULL; static PyObject *py_mod_bt2_exc_invalid_query_object_type = NULL; static PyObject *py_mod_bt2_exc_invalid_query_params_type = NULL; @@ -548,9 +503,6 @@ static void bt_py3_cc_init_from_bt2(void) py_mod_bt2_exc_stop_type = PyObject_GetAttrString(py_mod_bt2, "Stop"); BT_ASSERT(py_mod_bt2_exc_stop_type); - py_mod_bt2_exc_port_connection_refused_type = - PyObject_GetAttrString(py_mod_bt2, "PortConnectionRefused"); - BT_ASSERT(py_mod_bt2_exc_port_connection_refused_type); py_mod_bt2_exc_invalid_query_object_type = PyObject_GetAttrString(py_mod_bt2, "InvalidQueryObject"); BT_ASSERT(py_mod_bt2_exc_invalid_query_object_type); @@ -578,7 +530,6 @@ static void bt_py3_cc_exit_handler(void) Py_XDECREF(py_mod_bt2_exc_error_type); Py_XDECREF(py_mod_bt2_exc_try_again_type); Py_XDECREF(py_mod_bt2_exc_stop_type); - Py_XDECREF(py_mod_bt2_exc_port_connection_refused_type); Py_XDECREF(py_mod_bt2_exc_msg_iter_canceled_type); Py_XDECREF(py_mod_bt2_exc_invalid_query_object_type); Py_XDECREF(py_mod_bt2_exc_invalid_query_params_type); @@ -619,9 +570,9 @@ void bt2_py_loge_exception(void) /* * traceback can be NULL, when we fail to call a Python function from the - * native code (there is not Python stack at that point). E.g.: + * native code (there is no Python stack at that point). E.g.: * - * TypeError: _accept_port_connection_from_native() takes 3 positional arguments but 4 were given + * TypeError: _query_from_native() takes 5 positional arguments but 8 were given */ @@ -695,9 +646,6 @@ static bt_self_component_status bt_py3_exc_to_self_component_status(void) } else if (PyErr_GivenExceptionMatches(exc, py_mod_bt2_exc_stop_type)) { status = BT_SELF_COMPONENT_STATUS_END; - } else if (PyErr_GivenExceptionMatches(exc, - py_mod_bt2_exc_port_connection_refused_type)) { - status = BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION; } else { bt2_py_loge_exception(); status = BT_SELF_COMPONENT_STATUS_ERROR; @@ -942,147 +890,6 @@ bt_py3_component_class_sink_finalize(bt_self_component_sink *self_component_sink bt_py3_component_class_finalize(self_component); } -static bt_self_component_status -bt_py3_component_class_accept_port_connection( - bt_self_component *self_component, - bt_self_component_port *self_component_port, - bt_port_type self_component_port_type, - const bt_port *other_port) -{ - enum bt_self_component_status status; - PyObject *py_comp = NULL; - PyObject *py_self_port_ptr = NULL; - PyObject *py_other_port_ptr = NULL; - PyObject *py_method_result = NULL; - - py_comp = bt_self_component_get_data(self_component); - BT_ASSERT(py_comp); - - swig_type_info *self_component_port_swig_type = NULL; - swig_type_info *other_port_swig_type = NULL; - switch (self_component_port_type) { - case BT_PORT_TYPE_INPUT: - self_component_port_swig_type = SWIGTYPE_p_bt_self_component_port_input; - other_port_swig_type = SWIGTYPE_p_bt_port_output; - break; - case BT_PORT_TYPE_OUTPUT: - self_component_port_swig_type = SWIGTYPE_p_bt_self_component_port_output; - other_port_swig_type = SWIGTYPE_p_bt_port_input; - break; - } - BT_ASSERT(self_component_port_swig_type != NULL); - BT_ASSERT(other_port_swig_type != NULL); - - py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port), - self_component_port_swig_type, 0); - if (!py_self_port_ptr) { - BT_LOGE_STR("Failed to create a SWIG pointer object."); - goto error; - } - - py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port), - other_port_swig_type, 0); - if (!py_other_port_ptr) { - BT_LOGE_STR("Failed to create a SWIG pointer object."); - goto error; - } - - py_method_result = PyObject_CallMethod(py_comp, - "_accept_port_connection_from_native", "(OiO)", py_self_port_ptr, - self_component_port_type, py_other_port_ptr); - - status = bt_py3_exc_to_self_component_status(); - if (!py_method_result && status == BT_SELF_COMPONENT_STATUS_OK) { - /* Pretty sure this should never happen, but just in case */ - BT_LOGE("User's _accept_port_connection() method failed without raising an exception: " - "status=%d", status); - goto error; - } - - if (status == BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION) { - /* - * Looks like the user method raised - * PortConnectionRefused: accept this like if it - * returned False. - */ - goto end; - } else if (status != BT_SELF_COMPONENT_STATUS_OK) { - BT_LOGE("User's _accept_port_connection() raised an unexpected exception: " - "status=%d", status); - goto error; - } - - BT_ASSERT(PyBool_Check(py_method_result)); - - if (py_method_result == Py_True) { - status = BT_SELF_COMPONENT_STATUS_OK; - } else { - status = BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION; - } - - goto end; - -error: - status = BT_SELF_COMPONENT_STATUS_ERROR; - - /* - * Clear any exception: we're returning a bad status anyway. If - * this call originated from Python, then the user gets an - * appropriate error. - */ - PyErr_Clear(); - -end: - Py_XDECREF(py_self_port_ptr); - Py_XDECREF(py_other_port_ptr); - Py_XDECREF(py_method_result); - return status; -} - -static bt_self_component_status -bt_py3_component_class_source_accept_output_port_connection(bt_self_component_source *self_component_source, - bt_self_component_port_output *self_component_port_output, - const bt_port_input *other_port_input) -{ - bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source); - bt_self_component_port *self_component_port = bt_self_component_port_output_as_self_component_port(self_component_port_output); - const bt_port *other_port = bt_port_input_as_port_const(other_port_input); - return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_OUTPUT, other_port); -} - -static bt_self_component_status -bt_py3_component_class_filter_accept_input_port_connection(bt_self_component_filter *self_component_filter, - bt_self_component_port_input *self_component_port_input, - const bt_port_output *other_port_output) -{ - bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter); - bt_self_component_port *self_component_port = bt_self_component_port_input_as_self_component_port(self_component_port_input); - const bt_port *other_port = bt_port_output_as_port_const(other_port_output); - return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_INPUT, other_port); -} - -static bt_self_component_status -bt_py3_component_class_filter_accept_output_port_connection(bt_self_component_filter *self_component_filter, - bt_self_component_port_output *self_component_port_output, - const bt_port_input *other_port_input) -{ - bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter); - bt_self_component_port *self_component_port = bt_self_component_port_output_as_self_component_port(self_component_port_output); - const bt_port *other_port = bt_port_input_as_port_const(other_port_input); - return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_OUTPUT, other_port); -} - -static bt_self_component_status -bt_py3_component_class_sink_accept_input_port_connection(bt_self_component_sink *self_component_sink, - bt_self_component_port_input *self_component_port_input, - const bt_port_output *other_port_output) -{ - bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink); - bt_self_component_port *self_component_port = bt_self_component_port_input_as_self_component_port(self_component_port_input); - const bt_port *other_port = bt_port_output_as_port_const(other_port_output); - return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_INPUT, other_port); -} - static bt_self_component_status bt_py3_component_class_port_connected( bt_self_component *self_component, @@ -1632,9 +1439,6 @@ bt_component_class_source *bt_py3_component_class_source_create( BT_ASSERT(ret == 0); ret = bt_component_class_source_set_finalize_method (component_class_source, bt_py3_component_class_source_finalize); BT_ASSERT(ret == 0); - ret = bt_component_class_source_set_accept_output_port_connection_method(component_class_source, - bt_py3_component_class_source_accept_output_port_connection); - BT_ASSERT(ret == 0); ret = bt_component_class_source_set_output_port_connected_method(component_class_source, bt_py3_component_class_source_output_port_connected); BT_ASSERT(ret == 0); @@ -1681,12 +1485,6 @@ bt_component_class_filter *bt_py3_component_class_filter_create( BT_ASSERT(ret == 0); ret = bt_component_class_filter_set_finalize_method (component_class_filter, bt_py3_component_class_filter_finalize); BT_ASSERT(ret == 0); - ret = bt_component_class_filter_set_accept_input_port_connection_method(component_class_filter, - bt_py3_component_class_filter_accept_input_port_connection); - BT_ASSERT(ret == 0); - ret = bt_component_class_filter_set_accept_output_port_connection_method(component_class_filter, - bt_py3_component_class_filter_accept_output_port_connection); - BT_ASSERT(ret == 0); ret = bt_component_class_filter_set_input_port_connected_method(component_class_filter, bt_py3_component_class_filter_input_port_connected); BT_ASSERT(ret == 0); @@ -1736,9 +1534,6 @@ bt_component_class_sink *bt_py3_component_class_sink_create( BT_ASSERT(ret == 0); ret = bt_component_class_sink_set_finalize_method(component_class_sink, bt_py3_component_class_sink_finalize); BT_ASSERT(ret == 0); - ret = bt_component_class_sink_set_accept_input_port_connection_method(component_class_sink, - bt_py3_component_class_sink_accept_input_port_connection); - BT_ASSERT(ret == 0); ret = bt_component_class_sink_set_input_port_connected_method(component_class_sink, bt_py3_component_class_sink_input_port_connected); BT_ASSERT(ret == 0); diff --git a/src/bindings/python/bt2/bt2/native_bt_graph.i b/src/bindings/python/bt2/bt2/native_bt_graph.i index 0fcb70ee..7fe76cc3 100644 --- a/src/bindings/python/bt2/bt2/native_bt_graph.i +++ b/src/bindings/python/bt2/bt2/native_bt_graph.i @@ -107,7 +107,6 @@ typedef enum bt_graph_status { BT_GRAPH_STATUS_OK = 0, BT_GRAPH_STATUS_END = 1, BT_GRAPH_STATUS_AGAIN = 11, - BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111, BT_GRAPH_STATUS_CANCELED = 125, BT_GRAPH_STATUS_ERROR = -1, BT_GRAPH_STATUS_NOMEM = -12, diff --git a/src/cli/babeltrace2.c b/src/cli/babeltrace2.c index 396673d0..3cb751c3 100644 --- a/src/cli/babeltrace2.c +++ b/src/cli/babeltrace2.c @@ -1809,24 +1809,6 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( BT_LOGI_STR("Graph was canceled by user."); status = BT_GRAPH_STATUS_OK; break; - case BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION: - BT_LOGE("A component refused a connection to one of its ports: " - "upstream-comp-addr=%p, upstream-comp-name=\"%s\", " - "upstream-port-addr=%p, upstream-port-name=\"%s\", " - "downstream-comp-addr=%p, downstream-comp-name=\"%s\", " - "downstream-port-addr=%p, downstream-port-name=\"%s\", " - "conn-arg=\"%s\"", - upstream_comp, bt_component_get_name(upstream_comp), - upstream_port, bt_port_get_name(upstream_port), - downstream_comp, cfg_conn->downstream_comp_name->str, - downstream_port, downstream_port_name, - cfg_conn->arg->str); - fprintf(stderr, - "A component refused a connection to one of its ports (`%s` to `%s`): %s\n", - bt_port_get_name(upstream_port), - downstream_port_name, - cfg_conn->arg->str); - break; default: BT_LOGE("Cannot create connection: graph refuses to connect ports: " "upstream-comp-addr=%p, upstream-comp-name=\"%s\", " @@ -2574,8 +2556,6 @@ const char *bt_graph_status_str(bt_graph_status status) return "BT_GRAPH_STATUS_END"; case BT_GRAPH_STATUS_AGAIN: return "BT_GRAPH_STATUS_AGAIN"; - case BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION: - return "BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION"; case BT_GRAPH_STATUS_CANCELED: return "BT_GRAPH_STATUS_CANCELED"; case BT_GRAPH_STATUS_ERROR: diff --git a/src/common/common.h b/src/common/common.h index 6f9fb65d..23c913ef 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -603,8 +603,6 @@ const char *bt_self_component_status_string( return "BT_SELF_COMPONENT_STATUS_END"; case BT_SELF_COMPONENT_STATUS_AGAIN: return "BT_SELF_COMPONENT_STATUS_AGAIN"; - case BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION: - return "BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION"; case BT_SELF_COMPONENT_STATUS_ERROR: return "BT_SELF_COMPONENT_STATUS_ERROR"; case BT_SELF_COMPONENT_STATUS_NOMEM: diff --git a/src/lib/graph/component-class.c b/src/lib/graph/component-class.c index ad176f72..95c9b021 100644 --- a/src/lib/graph/component-class.c +++ b/src/lib/graph/component-class.c @@ -372,62 +372,6 @@ bt_component_class_sink_set_query_method( return BT_COMPONENT_CLASS_STATUS_OK; } -enum bt_component_class_status -bt_component_class_filter_set_accept_input_port_connection_method( - struct bt_component_class_filter *comp_cls, - bt_component_class_filter_accept_input_port_connection_method method) -{ - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); - BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls); - comp_cls->methods.accept_input_port_connection = method; - BT_LIB_LOGD("Set filter component class's \"accept input port connection\" method" - ": %!+C", comp_cls); - return BT_COMPONENT_CLASS_STATUS_OK; -} - -enum bt_component_class_status -bt_component_class_sink_set_accept_input_port_connection_method( - struct bt_component_class_sink *comp_cls, - bt_component_class_sink_accept_input_port_connection_method method) -{ - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); - BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls); - comp_cls->methods.accept_input_port_connection = method; - BT_LIB_LOGD("Set sink component class's \"accept input port connection\" method" - ": %!+C", comp_cls); - return BT_COMPONENT_CLASS_STATUS_OK; -} - -enum bt_component_class_status -bt_component_class_source_set_accept_output_port_connection_method( - struct bt_component_class_source *comp_cls, - bt_component_class_source_accept_output_port_connection_method method) -{ - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); - BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls); - comp_cls->methods.accept_output_port_connection = method; - BT_LIB_LOGD("Set source component class's \"accept output port connection\" method" - ": %!+C", comp_cls); - return BT_COMPONENT_CLASS_STATUS_OK; -} - -enum bt_component_class_status -bt_component_class_filter_set_accept_output_port_connection_method( - struct bt_component_class_filter *comp_cls, - bt_component_class_filter_accept_output_port_connection_method method) -{ - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); - BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls); - comp_cls->methods.accept_output_port_connection = method; - BT_LIB_LOGD("Set filter component class's \"accept output port connection\" method" - ": %!+C", comp_cls); - return BT_COMPONENT_CLASS_STATUS_OK; -} - enum bt_component_class_status bt_component_class_filter_set_input_port_connected_method( struct bt_component_class_filter *comp_cls, diff --git a/src/lib/graph/component-class.h b/src/lib/graph/component-class.h index b1e60f0f..bded3328 100644 --- a/src/lib/graph/component-class.h +++ b/src/lib/graph/component-class.h @@ -75,7 +75,6 @@ struct bt_component_class_source { bt_component_class_source_message_iterator_can_seek_ns_from_origin_method msg_iter_can_seek_ns_from_origin; bt_component_class_source_message_iterator_can_seek_beginning_method msg_iter_can_seek_beginning; bt_component_class_source_query_method query; - bt_component_class_source_accept_output_port_connection_method accept_output_port_connection; bt_component_class_source_output_port_connected_method output_port_connected; } methods; }; @@ -86,7 +85,6 @@ struct bt_component_class_sink { bt_component_class_sink_init_method init; bt_component_class_sink_finalize_method finalize; bt_component_class_sink_query_method query; - bt_component_class_sink_accept_input_port_connection_method accept_input_port_connection; bt_component_class_sink_input_port_connected_method input_port_connected; bt_component_class_sink_graph_is_configured_method graph_is_configured; bt_component_class_sink_consume_method consume; @@ -106,8 +104,6 @@ struct bt_component_class_filter { bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method msg_iter_can_seek_ns_from_origin; bt_component_class_filter_message_iterator_can_seek_beginning_method msg_iter_can_seek_beginning; bt_component_class_filter_query_method query; - bt_component_class_filter_accept_input_port_connection_method accept_input_port_connection; - bt_component_class_filter_accept_output_port_connection_method accept_output_port_connection; bt_component_class_filter_input_port_connected_method input_port_connected; bt_component_class_filter_output_port_connected_method output_port_connected; } methods; diff --git a/src/lib/graph/component.c b/src/lib/graph/component.c index 7a6e8b02..cf6d40c1 100644 --- a/src/lib/graph/component.c +++ b/src/lib/graph/component.c @@ -479,83 +479,6 @@ enum bt_self_component_status bt_component_add_output_port( BT_PORT_TYPE_OUTPUT, name, user_data, port); } -BT_HIDDEN -enum bt_self_component_status bt_component_accept_port_connection( - struct bt_component *comp, struct bt_port *self_port, - struct bt_port *other_port) -{ - typedef enum bt_self_component_status (*method_t)( - void *, void *, const void *); - - enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; - method_t method = NULL; - - BT_ASSERT(comp); - BT_ASSERT(self_port); - BT_ASSERT(other_port); - - switch (comp->class->type) { - case BT_COMPONENT_CLASS_TYPE_SOURCE: - { - struct bt_component_class_source *src_cc = (void *) comp->class; - - switch (self_port->type) { - case BT_PORT_TYPE_OUTPUT: - method = (method_t) src_cc->methods.accept_output_port_connection; - break; - default: - abort(); - } - - break; - } - case BT_COMPONENT_CLASS_TYPE_FILTER: - { - struct bt_component_class_filter *flt_cc = (void *) comp->class; - - switch (self_port->type) { - case BT_PORT_TYPE_INPUT: - method = (method_t) flt_cc->methods.accept_input_port_connection; - break; - case BT_PORT_TYPE_OUTPUT: - method = (method_t) flt_cc->methods.accept_output_port_connection; - break; - default: - abort(); - } - - break; - } - case BT_COMPONENT_CLASS_TYPE_SINK: - { - struct bt_component_class_sink *sink_cc = (void *) comp->class; - - switch (self_port->type) { - case BT_PORT_TYPE_INPUT: - method = (method_t) sink_cc->methods.accept_input_port_connection; - break; - default: - abort(); - } - - break; - } - default: - abort(); - } - - if (method) { - BT_LIB_LOGD("Calling user's \"accept port connection\" method: " - "%![comp-]+c, %![self-port-]+p, %![other-port-]+p", - comp, self_port, other_port); - status = method(comp, self_port, (void *) other_port); - BT_LOGD("User method returned: status=%s", - bt_self_component_status_string(status)); - } - - return status; -} - BT_HIDDEN enum bt_self_component_status bt_component_port_connected( struct bt_component *comp, struct bt_port *self_port, diff --git a/src/lib/graph/component.h b/src/lib/graph/component.h index accd5d1f..169d1a46 100644 --- a/src/lib/graph/component.h +++ b/src/lib/graph/component.h @@ -83,11 +83,6 @@ int bt_component_create(struct bt_component_class *component_class, const char *name, bt_logging_level log_level, struct bt_component **component); -BT_HIDDEN -enum bt_self_component_status bt_component_accept_port_connection( - struct bt_component *component, struct bt_port *self_port, - struct bt_port *other_port); - BT_HIDDEN enum bt_self_component_status bt_component_port_connected( struct bt_component *comp, diff --git a/src/lib/graph/graph.c b/src/lib/graph/graph.c index 734ebb7e..7301d23d 100644 --- a/src/lib/graph/graph.c +++ b/src/lib/graph/graph.c @@ -435,45 +435,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); diff --git a/src/lib/graph/graph.h b/src/lib/graph/graph.h index d2ce47ad..b3b178c6 100644 --- a/src/lib/graph/graph.h +++ b/src/lib/graph/graph.h @@ -183,8 +183,6 @@ const char *bt_graph_status_string(enum bt_graph_status status) return "BT_GRAPH_STATUS_OK"; case BT_GRAPH_STATUS_ERROR: return "BT_GRAPH_STATUS_ERROR"; - case BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION: - return "BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION"; case BT_GRAPH_STATUS_NOMEM: return "BT_GRAPH_STATUS_NOMEM"; default: diff --git a/src/lib/plugin/plugin-so.c b/src/lib/plugin/plugin-so.c index 13cf3220..2ecb1a7e 100644 --- a/src/lib/plugin/plugin-so.c +++ b/src/lib/plugin/plugin-so.c @@ -295,7 +295,6 @@ enum bt_plugin_status bt_plugin_so_init( bt_component_class_source_init_method init; bt_component_class_source_finalize_method finalize; bt_component_class_source_query_method query; - bt_component_class_source_accept_output_port_connection_method accept_output_port_connection; bt_component_class_source_output_port_connected_method output_port_connected; bt_component_class_source_message_iterator_init_method msg_iter_init; bt_component_class_source_message_iterator_finalize_method msg_iter_finalize; @@ -309,8 +308,6 @@ enum bt_plugin_status bt_plugin_so_init( bt_component_class_filter_init_method init; bt_component_class_filter_finalize_method finalize; bt_component_class_filter_query_method query; - bt_component_class_filter_accept_input_port_connection_method accept_input_port_connection; - bt_component_class_filter_accept_output_port_connection_method accept_output_port_connection; bt_component_class_filter_input_port_connected_method input_port_connected; bt_component_class_filter_output_port_connected_method output_port_connected; bt_component_class_filter_message_iterator_init_method msg_iter_init; @@ -325,7 +322,6 @@ enum bt_plugin_status bt_plugin_so_init( bt_component_class_sink_init_method init; bt_component_class_sink_finalize_method finalize; bt_component_class_sink_query_method query; - bt_component_class_sink_accept_input_port_connection_method accept_input_port_connection; bt_component_class_sink_input_port_connected_method input_port_connected; bt_component_class_sink_graph_is_configured_method graph_is_configured; } sink; @@ -541,34 +537,6 @@ enum bt_plugin_status bt_plugin_so_init( abort(); } break; - case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_INPUT_PORT_CONNECTION_METHOD: - switch (cc_type) { - case BT_COMPONENT_CLASS_TYPE_FILTER: - cc_full_descr->methods.filter.accept_input_port_connection = - cur_cc_descr_attr->value.filter_accept_input_port_connection_method; - break; - case BT_COMPONENT_CLASS_TYPE_SINK: - cc_full_descr->methods.sink.accept_input_port_connection = - cur_cc_descr_attr->value.sink_accept_input_port_connection_method; - break; - default: - abort(); - } - break; - case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_ACCEPT_OUTPUT_PORT_CONNECTION_METHOD: - switch (cc_type) { - case BT_COMPONENT_CLASS_TYPE_SOURCE: - cc_full_descr->methods.source.accept_output_port_connection = - cur_cc_descr_attr->value.source_accept_output_port_connection_method; - break; - case BT_COMPONENT_CLASS_TYPE_FILTER: - cc_full_descr->methods.filter.accept_output_port_connection = - cur_cc_descr_attr->value.filter_accept_output_port_connection_method; - break; - default: - abort(); - } - break; case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INPUT_PORT_CONNECTED_METHOD: switch (cc_type) { case BT_COMPONENT_CLASS_TYPE_FILTER: @@ -868,18 +836,6 @@ enum bt_plugin_status bt_plugin_so_init( } } - if (cc_full_descr->methods.source.accept_output_port_connection) { - ret = bt_component_class_source_set_accept_output_port_connection_method( - src_comp_class, - cc_full_descr->methods.source.accept_output_port_connection); - if (ret) { - BT_LOGE_STR("Cannot set source component class's \"accept input output connection\" method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_OBJECT_PUT_REF_AND_RESET(src_comp_class); - goto end; - } - } - if (cc_full_descr->methods.source.output_port_connected) { ret = bt_component_class_source_set_output_port_connected_method( src_comp_class, @@ -1002,30 +958,6 @@ enum bt_plugin_status bt_plugin_so_init( } } - if (cc_full_descr->methods.filter.accept_input_port_connection) { - ret = bt_component_class_filter_set_accept_input_port_connection_method( - flt_comp_class, - cc_full_descr->methods.filter.accept_input_port_connection); - if (ret) { - BT_LOGE_STR("Cannot set filter component class's \"accept input port connection\" method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class); - goto end; - } - } - - if (cc_full_descr->methods.filter.accept_output_port_connection) { - ret = bt_component_class_filter_set_accept_output_port_connection_method( - flt_comp_class, - cc_full_descr->methods.filter.accept_output_port_connection); - if (ret) { - BT_LOGE_STR("Cannot set filter component class's \"accept input output connection\" method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class); - goto end; - } - } - if (cc_full_descr->methods.filter.input_port_connected) { ret = bt_component_class_filter_set_input_port_connected_method( flt_comp_class, @@ -1160,18 +1092,6 @@ enum bt_plugin_status bt_plugin_so_init( } } - if (cc_full_descr->methods.sink.accept_input_port_connection) { - ret = bt_component_class_sink_set_accept_input_port_connection_method( - sink_comp_class, - cc_full_descr->methods.sink.accept_input_port_connection); - if (ret) { - BT_LOGE_STR("Cannot set sink component class's \"accept input port connection\" method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_OBJECT_PUT_REF_AND_RESET(sink_comp_class); - goto end; - } - } - if (cc_full_descr->methods.sink.input_port_connected) { ret = bt_component_class_sink_set_input_port_connected_method( sink_comp_class, diff --git a/tests/bindings/python/bt2/test_graph.py b/tests/bindings/python/bt2/test_graph.py index 1df1d32f..9b82b791 100644 --- a/tests/bindings/python/bt2/test_graph.py +++ b/tests/bindings/python/bt2/test_graph.py @@ -173,33 +173,6 @@ class GraphTestCase(unittest.TestCase): conn = self._graph.connect_ports(sink.input_ports['in'], src.output_ports['out']) - def test_connect_ports_refused(self): - class MyIter(bt2._UserMessageIterator): - def __next__(self): - raise bt2.Stop - - class MySource(bt2._UserSourceComponent, - message_iterator_class=MyIter): - def __init__(self, params): - self._add_output_port('out') - - class MySink(bt2._UserSinkComponent): - def __init__(self, params): - self._add_input_port('in') - - def _consume(self): - raise bt2.Stop - - def _accept_port_connection(self, port, other_port): - return False - - src = self._graph.add_component(MySource, 'src') - sink = self._graph.add_component(MySink, 'sink') - - with self.assertRaises(bt2.PortConnectionRefused): - conn = self._graph.connect_ports(src.output_ports['out'], - sink.input_ports['in']) - def test_cancel(self): self.assertFalse(self._graph.is_canceled) self._graph.cancel() diff --git a/tests/lib/test_graph_topo.c b/tests/lib/test_graph_topo.c index 0a3111cd..e0ea4258 100644 --- a/tests/lib/test_graph_topo.c +++ b/tests/lib/test_graph_topo.c @@ -26,11 +26,9 @@ #include "tap/tap.h" -#define NR_TESTS 48 +#define NR_TESTS 33 enum event_type { - SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION, - SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION, SRC_COMP_OUTPUT_PORT_CONNECTED, SINK_COMP_INPUT_PORT_CONNECTED, GRAPH_SRC_OUTPUT_PORT_ADDED, @@ -50,18 +48,6 @@ struct event { enum event_type type; union { - struct { - const bt_component *comp; - const bt_port *self_port; - const bt_port *other_port; - } src_comp_accept_output_port_connection; - - struct { - const bt_component *comp; - const bt_port *self_port; - const bt_port *other_port; - } sink_comp_accept_input_port_connection; - struct { const bt_component *comp; const bt_port *self_port; @@ -118,38 +104,6 @@ bool compare_events(struct event *ev_a, struct event *ev_b) } switch (ev_a->type) { - case SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION: - if (ev_a->data.src_comp_accept_output_port_connection.comp != - ev_b->data.src_comp_accept_output_port_connection.comp) { - return false; - } - - if (ev_a->data.src_comp_accept_output_port_connection.self_port != - ev_b->data.src_comp_accept_output_port_connection.self_port) { - return false; - } - - if (ev_a->data.src_comp_accept_output_port_connection.other_port != - ev_b->data.src_comp_accept_output_port_connection.other_port) { - return false; - } - break; - case SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION: - if (ev_a->data.sink_comp_accept_input_port_connection.comp != - ev_b->data.sink_comp_accept_input_port_connection.comp) { - return false; - } - - if (ev_a->data.sink_comp_accept_input_port_connection.self_port != - ev_b->data.sink_comp_accept_input_port_connection.self_port) { - return false; - } - - if (ev_a->data.sink_comp_accept_input_port_connection.other_port != - ev_b->data.sink_comp_accept_input_port_connection.other_port) { - return false; - } - break; case SRC_COMP_OUTPUT_PORT_CONNECTED: if (ev_a->data.src_comp_output_port_connected.comp != ev_b->data.src_comp_output_port_connected.comp) { @@ -273,52 +227,6 @@ bt_self_message_iterator_status src_iter_next( return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR; } -static -bt_self_component_status src_accept_output_port_connection( - bt_self_component_source *self_comp, - bt_self_component_port_output *self_comp_port, - const bt_port_input *other_port) -{ - struct event event = { - .type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION, - .data.src_comp_accept_output_port_connection = { - .comp = bt_self_component_as_component( - bt_self_component_source_as_self_component( - self_comp)), - .self_port = bt_self_component_port_as_port( - bt_self_component_port_output_as_self_component_port( - self_comp_port)), - .other_port = bt_port_input_as_port_const(other_port), - }, - }; - - append_event(&event); - return BT_SELF_COMPONENT_STATUS_OK; -} - -static -bt_self_component_status sink_accept_input_port_connection( - bt_self_component_sink *self_comp, - bt_self_component_port_input *self_comp_port, - const bt_port_output *other_port) -{ - struct event event = { - .type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION, - .data.sink_comp_accept_input_port_connection = { - .comp = bt_self_component_as_component( - bt_self_component_sink_as_self_component( - self_comp)), - .self_port = bt_self_component_port_as_port( - bt_self_component_port_input_as_self_component_port( - self_comp_port)), - .other_port = bt_port_output_as_port_const(other_port), - }, - }; - - append_event(&event); - return BT_SELF_COMPONENT_STATUS_OK; -} - static bt_self_component_status src_output_port_connected( bt_self_component_source *self_comp, @@ -490,9 +398,6 @@ void init_test(void) ret = bt_component_class_source_set_init_method( src_comp_class, src_init); BT_ASSERT(ret == 0); - ret = bt_component_class_source_set_accept_output_port_connection_method( - src_comp_class, src_accept_output_port_connection); - BT_ASSERT(ret == 0); ret = bt_component_class_source_set_output_port_connected_method( src_comp_class, src_output_port_connected); BT_ASSERT(ret == 0); @@ -502,9 +407,6 @@ void init_test(void) ret = bt_component_class_sink_set_init_method(sink_comp_class, sink_init); BT_ASSERT(ret == 0); - ret = bt_component_class_sink_set_accept_input_port_connection_method( - sink_comp_class, sink_accept_input_port_connection); - BT_ASSERT(ret == 0); ret = bt_component_class_sink_set_input_port_connected_method( sink_comp_class, sink_input_port_connected); BT_ASSERT(ret == 0); @@ -587,8 +489,6 @@ void test_src_adds_port_in_port_connected(void) const bt_port *gsink_def_port; struct event event; bt_graph_status status; - size_t src_accept_port_connection_pos; - size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; size_t sink_port_connected_pos; size_t graph_ports_connected_pos; @@ -618,8 +518,8 @@ void test_src_adds_port_in_port_connected(void) gsrc_hello_port = bt_port_output_as_port_const(src_hello_port); gsink_def_port = bt_port_input_as_port_const(sink_def_port); - /* We're supposed to have 8 events */ - ok(events->len == 8, "we have the expected number of events"); + /* We're supposed to have 6 events */ + ok(events->len == 6, "we have the expected number of events"); /* Source's port added */ event.type = GRAPH_SRC_OUTPUT_PORT_ADDED; @@ -633,22 +533,6 @@ void test_src_adds_port_in_port_connected(void) event.data.graph_sink_input_port_added.port = gsink_def_port; ok(has_event(&event), "got the expected graph's port added event (for sink, initial)"); - /* Source's accept port connection */ - event.type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION; - event.data.src_comp_accept_output_port_connection.comp = gsrc; - event.data.src_comp_accept_output_port_connection.self_port = gsrc_def_port; - event.data.src_comp_accept_output_port_connection.other_port = gsink_def_port; - ok(has_event(&event), "got the expected source's accept port connection event"); - src_accept_port_connection_pos = event_pos(&event); - - /* Sink's accept port connection */ - event.type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION; - event.data.sink_comp_accept_input_port_connection.comp = gsink; - event.data.sink_comp_accept_input_port_connection.self_port = gsink_def_port; - event.data.sink_comp_accept_input_port_connection.other_port = gsrc_def_port; - ok(has_event(&event), "got the expected sink's accept port connection event"); - sink_accept_port_connection_pos = event_pos(&event); - /* Source's port connected */ event.type = SRC_COMP_OUTPUT_PORT_CONNECTED; event.data.src_comp_output_port_connected.comp = gsrc; @@ -686,14 +570,10 @@ void test_src_adds_port_in_port_connected(void) "event order is good (1)"); ok(sink_port_connected_pos < graph_ports_connected_pos, "event order is good (2)"); - ok(src_accept_port_connection_pos < src_port_connected_pos, - "event order is good (3)"); - ok(sink_accept_port_connection_pos < sink_port_connected_pos, - "event order is good (4)"); ok(src_port_connected_pos < graph_port_added_src_pos, - "event order is good (5)"); + "event order is good (3)"); ok(graph_port_added_src_pos < graph_ports_connected_pos, - "event order is good (6)"); + "event order is good (4)"); bt_component_source_put_ref(src); bt_component_sink_put_ref(sink); @@ -714,8 +594,6 @@ void test_simple(void) const bt_port *gsink_def_port; struct event event; bt_graph_status status; - size_t src_accept_port_connection_pos; - size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; size_t sink_port_connected_pos; size_t graph_ports_connected_pos; @@ -739,8 +617,8 @@ void test_simple(void) gsrc_def_port = bt_port_output_as_port_const(src_def_port); gsink_def_port = bt_port_input_as_port_const(sink_def_port); - /* We're supposed to have 7 events */ - ok(events->len == 7, "we have the expected number of events"); + /* We're supposed to have 5 events */ + ok(events->len == 5, "we have the expected number of events"); /* Source's port added */ event.type = GRAPH_SRC_OUTPUT_PORT_ADDED; @@ -754,22 +632,6 @@ void test_simple(void) event.data.graph_sink_input_port_added.port = gsink_def_port; ok(has_event(&event), "got the expected graph's port added event (for sink, initial)"); - /* Source's accept port connection */ - event.type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION; - event.data.src_comp_accept_output_port_connection.comp = gsrc; - event.data.src_comp_accept_output_port_connection.self_port = gsrc_def_port; - event.data.src_comp_accept_output_port_connection.other_port = gsink_def_port; - ok(has_event(&event), "got the expected source's accept port connection event"); - src_accept_port_connection_pos = event_pos(&event); - - /* Sink's accept port connection */ - event.type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION; - event.data.sink_comp_accept_input_port_connection.comp = gsink; - event.data.sink_comp_accept_input_port_connection.self_port = gsink_def_port; - event.data.sink_comp_accept_input_port_connection.other_port = gsrc_def_port; - ok(has_event(&event), "got the expected sink's accept port connection event"); - sink_accept_port_connection_pos = event_pos(&event); - /* Source's port connected */ event.type = SRC_COMP_OUTPUT_PORT_CONNECTED; event.data.src_comp_output_port_connected.comp = gsrc; @@ -800,10 +662,6 @@ void test_simple(void) "event order is good (1)"); ok(sink_port_connected_pos < graph_ports_connected_pos, "event order is good (2)"); - ok(src_accept_port_connection_pos < src_port_connected_pos, - "event order is good (3)"); - ok(sink_accept_port_connection_pos < sink_port_connected_pos, - "event order is good (4)"); bt_component_sink_put_ref(sink); bt_graph_put_ref(graph); @@ -825,8 +683,6 @@ void test_src_port_connected_error(void) const bt_connection *conn = NULL; struct event event; bt_graph_status status; - size_t src_accept_port_connection_pos; - size_t src_port_connected_pos; prepare_test(TEST_SRC_PORT_CONNECTED_ERROR, "port connected error: source"); graph = create_graph(); @@ -849,8 +705,8 @@ void test_src_port_connected_error(void) gsrc_def_port = bt_port_output_as_port_const(src_def_port); gsink_def_port = bt_port_input_as_port_const(sink_def_port); - /* We're supposed to have 5 events */ - ok(events->len == 5, "we have the expected number of events"); + /* We're supposed to have 3 events */ + ok(events->len == 3, "we have the expected number of events"); /* Source's port added */ event.type = GRAPH_SRC_OUTPUT_PORT_ADDED; @@ -864,32 +720,12 @@ void test_src_port_connected_error(void) event.data.graph_sink_input_port_added.port = gsink_def_port; ok(has_event(&event), "got the expected graph's port added event (for sink, initial)"); - /* Source's accept port connection */ - event.type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION; - event.data.src_comp_accept_output_port_connection.comp = gsrc; - event.data.src_comp_accept_output_port_connection.self_port = gsrc_def_port; - event.data.src_comp_accept_output_port_connection.other_port = gsink_def_port; - ok(has_event(&event), "got the expected source's accept port connection event"); - src_accept_port_connection_pos = event_pos(&event); - - /* Sink's accept port connection */ - event.type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION; - event.data.sink_comp_accept_input_port_connection.comp = gsink; - event.data.sink_comp_accept_input_port_connection.self_port = gsink_def_port; - event.data.sink_comp_accept_input_port_connection.other_port = gsrc_def_port; - ok(has_event(&event), "got the expected sink's accept port connection event"); - /* Source's port connected */ event.type = SRC_COMP_OUTPUT_PORT_CONNECTED; event.data.src_comp_output_port_connected.comp = gsrc; event.data.src_comp_output_port_connected.self_port = gsrc_def_port; event.data.src_comp_output_port_connected.other_port = gsink_def_port; ok(has_event(&event), "got the expected source's port connected event"); - src_port_connected_pos = event_pos(&event); - - /* Order of events */ - ok(src_accept_port_connection_pos < src_port_connected_pos, - "event order is good (1)"); bt_graph_put_ref(graph); bt_component_sink_put_ref(sink); @@ -912,10 +748,6 @@ void test_sink_port_connected_error(void) const bt_connection *conn = NULL; struct event event; bt_graph_status status; - size_t src_accept_port_connection_pos; - size_t sink_accept_port_connection_pos; - size_t src_port_connected_pos; - size_t sink_port_connected_pos; prepare_test(TEST_SINK_PORT_CONNECTED_ERROR, "port connected error: sink"); graph = create_graph(); @@ -938,8 +770,8 @@ void test_sink_port_connected_error(void) gsrc_def_port = bt_port_output_as_port_const(src_def_port); gsink_def_port = bt_port_input_as_port_const(sink_def_port); - /* We're supposed to have 6 events */ - ok(events->len == 6, "we have the expected number of events"); + /* We're supposed to have 4 events */ + ok(events->len == 4, "we have the expected number of events"); /* Source's port added */ event.type = GRAPH_SRC_OUTPUT_PORT_ADDED; @@ -953,29 +785,12 @@ void test_sink_port_connected_error(void) event.data.graph_sink_input_port_added.port = gsink_def_port; ok(has_event(&event), "got the expected graph's port added event (for sink, initial)"); - /* Source's accept port connection */ - event.type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION; - event.data.src_comp_accept_output_port_connection.comp = gsrc; - event.data.src_comp_accept_output_port_connection.self_port = gsrc_def_port; - event.data.src_comp_accept_output_port_connection.other_port = gsink_def_port; - ok(has_event(&event), "got the expected source's accept port connection event"); - src_accept_port_connection_pos = event_pos(&event); - - /* Sink's accept port connection */ - event.type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION; - event.data.sink_comp_accept_input_port_connection.comp = gsink; - event.data.sink_comp_accept_input_port_connection.self_port = gsink_def_port; - event.data.sink_comp_accept_input_port_connection.other_port = gsrc_def_port; - ok(has_event(&event), "got the expected sink's accept port connection event"); - sink_accept_port_connection_pos = event_pos(&event); - /* Source's port connected */ event.type = SRC_COMP_OUTPUT_PORT_CONNECTED; event.data.src_comp_output_port_connected.comp = gsrc; event.data.src_comp_output_port_connected.self_port = gsrc_def_port; event.data.src_comp_output_port_connected.other_port = gsink_def_port; ok(has_event(&event), "got the expected source's port connected event"); - src_port_connected_pos = event_pos(&event); /* Sink's port connected */ event.type = SINK_COMP_INPUT_PORT_CONNECTED; @@ -983,13 +798,6 @@ void test_sink_port_connected_error(void) event.data.sink_comp_input_port_connected.self_port = gsink_def_port; event.data.sink_comp_input_port_connected.other_port = gsrc_def_port; ok(has_event(&event), "got the expected sink's port connected event"); - sink_port_connected_pos = event_pos(&event); - - /* Order of events */ - ok(src_accept_port_connection_pos < src_port_connected_pos, - "event order is good (1)"); - ok(sink_accept_port_connection_pos < sink_port_connected_pos, - "event order is good (2)"); bt_connection_put_ref(conn); bt_graph_put_ref(graph); -- 2.34.1