Teach starter about nodes lists
To prevent trying to start an application on the wrong node.
Change-Id: I5261d434d7c7511120cdaafbcab2326b7b5640bd
diff --git a/aos/starter/starterd_lib.cc b/aos/starter/starterd_lib.cc
index ea7fdee..9d74089 100644
--- a/aos/starter/starterd_lib.cc
+++ b/aos/starter/starterd_lib.cc
@@ -406,8 +406,22 @@
if (config_msg_->has_applications()) {
const flatbuffers::Vector<flatbuffers::Offset<aos::Application>>
*applications = config_msg_->applications();
- for (const aos::Application *application : *applications) {
- AddApplication(application);
+
+ if (aos::configuration::MultiNode(config_msg_)) {
+ std::string_view current_node = event_loop_.node()->name()->string_view();
+ for (const aos::Application *application : *applications) {
+ CHECK(application->has_nodes());
+ for (const flatbuffers::String *node : *application->nodes()) {
+ if (node->string_view() == current_node) {
+ AddApplication(application);
+ break;
+ }
+ }
+ }
+ } else {
+ for (const aos::Application *application : *applications) {
+ AddApplication(application);
+ }
}
}
}