mirror of
https://github.com/BotChain-Robots/control.git
synced 2026-03-09 16:22:26 +01:00
Stop returning connections between modules that do not exist
This commit is contained in:
@@ -59,11 +59,15 @@ std::vector<std::weak_ptr<Module>> RobotController::getModules() {
|
|||||||
|
|
||||||
std::vector<Flatbuffers::ModuleConnectionInstance> RobotController::getConnections() {
|
std::vector<Flatbuffers::ModuleConnectionInstance> RobotController::getConnections() {
|
||||||
std::vector<Flatbuffers::ModuleConnectionInstance> out;
|
std::vector<Flatbuffers::ModuleConnectionInstance> out;
|
||||||
std::shared_lock lock(m_connection_lock);
|
std::shared_lock module_lock(m_module_lock);
|
||||||
|
std::shared_lock conn_lock(m_connection_lock);
|
||||||
|
|
||||||
for (auto const &[_, value] : m_connection_map) {
|
for (auto const &[_, value] : m_connection_map) {
|
||||||
for (const auto conn : value) {
|
for (const auto conn : value) {
|
||||||
out.push_back(conn);
|
if (m_id_to_module.contains(conn.from_module_id) &&
|
||||||
|
m_id_to_module.contains(conn.to_module_id)) {
|
||||||
|
out.push_back(conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
Reference in New Issue
Block a user