lib: remove "accept port" concept
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 19 Jun 2019 20:22:54 +0000 (16:22 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 25 Jun 2019 15:35:48 +0000 (11:35 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1522
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
23 files changed:
include/babeltrace2/graph/component-class-filter.h
include/babeltrace2/graph/component-class-sink.h
include/babeltrace2/graph/component-class-source.h
include/babeltrace2/graph/graph-const.h
include/babeltrace2/graph/self-component.h
include/babeltrace2/plugin/plugin-dev.h
src/bindings/python/bt2/bt2/__init__.py.in
src/bindings/python/bt2/bt2/component.py
src/bindings/python/bt2/bt2/graph.py
src/bindings/python/bt2/bt2/native_bt_component.i
src/bindings/python/bt2/bt2/native_bt_component_class.i
src/bindings/python/bt2/bt2/native_bt_graph.i
src/cli/babeltrace2.c
src/common/common.h
src/lib/graph/component-class.c
src/lib/graph/component-class.h
src/lib/graph/component.c
src/lib/graph/component.h
src/lib/graph/graph.c
src/lib/graph/graph.h
src/lib/plugin/plugin-so.c
tests/bindings/python/bt2/test_graph.py
tests/lib/test_graph_topo.c

index e516a28882b157ae1aa485d37751e7f9f13b7e66..af7fbf18e6206269a820798b978342129200030f 100644 (file)
@@ -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,
index 6cee6726a8aeb4d990f315875c92f2c8be9bf44a..f4b2bb8c6fae1059a4fd3e7d69d4e1de86598584 100644 (file)
@@ -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,
index 6536426a00180e3f7fa72f9056a28cd969050b45..05fb5a4b1f88f22f1f38503fa9c53f5d4c2d615a 100644 (file)
@@ -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,
index c2dd64cd27ca8a3835b08dd67acee23fadae6a04..97672b7b905abd402791dd4449c0c28f21590804 100644 (file)
@@ -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,
index fe4e4df551b38a6a8dac8671e99e1b66473c5110..4d53697f953dd8de1ba5d1f57f8a7b7068704021 100644 (file)
@@ -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;
index 5f7d2826917ac49ffcc0b4f45cd4c7fe6c6171ad..b266a92b3688aefd28b0c19fe5da8cab32dcae97 100644 (file)
@@ -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
index 1bebfd4e0ab2cc0171cb6739e55cfdc4d4918bf5..fe987a3dc9e58afe10e9281ea7ee38a5dd80a664 100644 (file)
@@ -90,10 +90,6 @@ class Stop(StopIteration):
     pass
 
 
-class PortConnectionRefused(Exception):
-    pass
-
-
 class IncompleteUserClass(Error):
     pass
 
index b2edd34e49e4515a63a7d234e75671ff01fce4dd..7f56757d61a8414543e7f733cbbb8f23ef9088a2 100644 (file)
@@ -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
 
index 849b208a10e58dfa5e96611b12942837aa0cf6d3..f1270b5a66a8582bac4c2432327abc792210a4cd 100644 (file)
@@ -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
index 9eb946e8c9303366784e2ff213ed2823eec3db23..e663c7220c8e76c7404c6687b6450e9876cd486c 100644 (file)
@@ -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;
index 522990a29da8aefc83ae92c9417047acaf4ef98a..6deb22ef5ae22f10815dc704786cb892b24e41af 100644 (file)
@@ -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);
index 0fcb70eef95665ff0b0bade9df2ab0e76265b7ce..7fe76cc31f734d2333666705ae50a22aecc46201 100644 (file)
@@ -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,
index 396673d0d63ed996c7b9b601ad8d3c96c9511fa1..3cb751c3c5770af3d71c897df62e42c6af91a888 100644 (file)
@@ -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:
index 6f9fb65df4bf069fbe24dc07a5ceb20784600a3f..23c913efbb809d6f2f5ca72c7f68724cec584b2a 100644 (file)
@@ -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:
index ad176f723693b0fd6a1fdc628afbd054237dc708..95c9b02199620d9f0a5e7de9d3f61a37137ce22f 100644 (file)
@@ -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,
index b1e60f0fdbf03ae2a5c73e31ac0d315d8ea0222b..bded3328a3981eb0e0a0f85ac822de128d2f2cbf 100644 (file)
@@ -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;
index 7a6e8b021cf97c856061912d70028598120da3c1..cf6d40c183d8fe0bbc0258dbd102f5051a8df087 100644 (file)
@@ -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,
index accd5d1ffa5a34ecb4a476defc1a032a6db70f43..169d1a46ed0aef8c370d4689135eaa4b5b3265c6 100644 (file)
@@ -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,
index 734ebb7ea1906c077356936efed93aefc2423f19..7301d23dc64761360a9d13a167fd7049012bdd8e 100644 (file)
@@ -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);
index d2ce47ad6ae94e37b09500f8d31175a5d418c7f0..b3b178c647bf4e9ae9b49aa2af3bab96067b9762 100644 (file)
@@ -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:
index 13cf322084e2e0376b9bc76eff76be4c2373c0fd..2ecb1a7e3bee22a3de0a2af69f37f2099f587356 100644 (file)
@@ -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,
index 1df1d32f9b76c82b422770245e76a83ad3f0ad48..9b82b791a13dac5ccdf1d8dcace13b53bfcd4fd8 100644 (file)
@@ -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()
index 0a3111cdfeecbfa4f10167a8b02057e1b3c9de4a..e0ea4258158c143a82dd6b44183e950f9eb8c5e9 100644 (file)
 
 #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);
This page took 0.049867 seconds and 4 git commands to generate.