diff options
-rw-r--r-- | host/include/uhd/rfnoc/node.hpp | 13 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/node_accessor.hpp | 9 | ||||
-rw-r--r-- | host/lib/rfnoc/graph.cpp | 13 | ||||
-rw-r--r-- | host/lib/rfnoc/node.cpp | 1 |
4 files changed, 35 insertions, 1 deletions
diff --git a/host/include/uhd/rfnoc/node.hpp b/host/include/uhd/rfnoc/node.hpp index 9d66c516a..0a49d1609 100644 --- a/host/include/uhd/rfnoc/node.hpp +++ b/host/include/uhd/rfnoc/node.hpp @@ -570,6 +570,13 @@ private: _resolve_all_cb = resolver; } + /*! Restores the default property resolution behavior of the node. + */ + void clear_resolve_all_callback() + { + _resolve_all_cb = _default_resolve_all_cb; + } + /*! Forward the value of an edge property into this node * * Note that \p incoming_prop is a reference to the neighbouring node's @@ -655,7 +662,11 @@ private: //! A callback that can be called to notify the graph manager that something // has changed, and that a property resolution needs to be performed. - resolve_callback_t _resolve_all_cb = [this]() { + resolve_callback_t _resolve_all_cb; + + //! This is the default implementation of the property resolution + // method. + const resolve_callback_t _default_resolve_all_cb = [this]() { resolve_props(); clean_props(); }; diff --git a/host/lib/include/uhdlib/rfnoc/node_accessor.hpp b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp index 4c63d29e2..5a9fd3a7f 100644 --- a/host/lib/include/uhdlib/rfnoc/node_accessor.hpp +++ b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp @@ -69,6 +69,15 @@ public: node->set_resolve_all_callback(std::move(resolver)); } + /* Restore the resolver callback to its default implementation + * + * See node_t::clear_resolve_all_callback() for details. + */ + void clear_resolve_all_callback(node_t* node) + { + node->clear_resolve_all_callback(); + } + /*! Forward an edge property to \p dst_node * * See node_t::forward_edge_property() for details. diff --git a/host/lib/rfnoc/graph.cpp b/host/lib/rfnoc/graph.cpp index a26ed33fc..1fc60cf6e 100644 --- a/host/lib/rfnoc/graph.cpp +++ b/host/lib/rfnoc/graph.cpp @@ -183,11 +183,18 @@ void graph_t::disconnect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t { std::lock_guard<std::recursive_mutex> l(_graph_mutex); + node_accessor_t node_accessor{}; + // Find vertex descriptor if (_node_map.count(src_node) == 0 && _node_map.count(dst_node) == 0) { return; } + UHD_LOG_TRACE(LOG_ID, + "Disconnecting block " << src_node->get_unique_id() << ":" << edge_info.src_port + << " -> " << dst_node->get_unique_id() << ":" + << edge_info.dst_port); + auto src_vertex_desc = _node_map.at(src_node); auto dst_vertex_desc = _node_map.at(dst_node); @@ -202,6 +209,9 @@ void graph_t::disconnect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t if (boost::degree(src_vertex_desc, _graph) == 0) { _remove_node(src_node); + UHD_LOG_TRACE(LOG_ID, + "Removing block " << src_node->get_unique_id() << ":" << edge_info.src_port); + node_accessor.clear_resolve_all_callback(src_node); } // Re-look up the vertex descriptor for dst_node, as the act of removing @@ -209,6 +219,9 @@ void graph_t::disconnect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t dst_vertex_desc = _node_map.at(dst_node); if (boost::degree(dst_vertex_desc, _graph) == 0) { _remove_node(dst_node); + UHD_LOG_TRACE(LOG_ID, + "Removing block " << dst_node->get_unique_id() << ":" << edge_info.dst_port); + node_accessor.clear_resolve_all_callback(dst_node); } } diff --git a/host/lib/rfnoc/node.cpp b/host/lib/rfnoc/node.cpp index 062645b93..e7f166e93 100644 --- a/host/lib/rfnoc/node.cpp +++ b/host/lib/rfnoc/node.cpp @@ -19,6 +19,7 @@ dirtifier_t node_t::ALWAYS_DIRTY{}; node_t::node_t() { + _resolve_all_cb = _default_resolve_all_cb; register_property(&ALWAYS_DIRTY); } |