From fb6b8f61788e044bd4459935ef1f701a4c5650a8 Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Tue, 12 Mar 2024 18:29:40 +0100 Subject: [PATCH] FIX: fixed the incorect setting of the command port and chnaged to connecet to the virtual console in the cms --- libs/KubeControl | 2 +- src/SimControl/SimControl.cpp | 33 +++++++++++++++++++++++++++++---- src/main.cpp | 6 ++++-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/libs/KubeControl b/libs/KubeControl index e38214f..48101a6 160000 --- a/libs/KubeControl +++ b/libs/KubeControl @@ -1 +1 @@ -Subproject commit e38214f4d0a9e2a17ba34011324d6284dd6f5a80 +Subproject commit 48101a673a54fa3afe6c25d98e675140ae0a951b diff --git a/src/SimControl/SimControl.cpp b/src/SimControl/SimControl.cpp index b8f683d..b9be24d 100644 --- a/src/SimControl/SimControl.cpp +++ b/src/SimControl/SimControl.cpp @@ -23,6 +23,7 @@ +#include #include #include #include @@ -40,7 +41,12 @@ namespace SimControl { SimControl::SimControl(bool online,std::string CommandPort,std::string GroundTruthAddr, ushort GroundTruthPort,std::string Namespace): - online_(online),CommandPort_(CommandPort),GroundTruthAddr_(GroundTruthAddr),GroundTruthPort_(GroundTruthPort),Namespace_(Namespace),ID_(SimCore::Identifier(xg::newGuid())) + online_(online), + CommandPort_(CommandPort), + GroundTruthAddr_(GroundTruthAddr), + GroundTruthPort_(GroundTruthPort), + Namespace_(Namespace), + ID_(SimCore::Identifier(xg::newGuid())) { // BroadcastListener_ = std::make_shared("239.0.0.1",10000); BroadcastListener_ = std::make_shared(GroundTruthAddr_,GroundTruthPort_); @@ -467,9 +473,28 @@ namespace SimControl { // LOG_S(INFO)<<"REQUEST: "<getInfoForPod(id); - - LOG_S(INFO)<<"PODS Info: " < cmsPod = nullptr; + bool hasCMS = false; + std::string IP = info.IP; + + for (auto child: info.Childs) { + if (child.Component == "cms") + { + cmsPod = std::make_unique(child); + hasCMS = true; + } + } + + if (cmsPod == nullptr && hasCMS == true) + { + return; + } + IP = cmsPod->IP; + + + LOG_S(INFO)<<"PODS Info: " <IP; + + DirectCommunication::DirectCommunicationClient client(std::stoi(CommandPort_),IP,ID_.getUUID()); Orders::TracklistRequest TrackListRequest(ID_,SimCore::Identifier(id),true); // SimCore::Control control(this->ID_,SimCore::ControlType::GET_TRACKLIST,"Tracklist"); client.sendMessage(TrackListRequest.buildMessage()); diff --git a/src/main.cpp b/src/main.cpp index 5cecff1..5316d1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,11 +42,11 @@ int main() } const char* GroundTruthAddr = "239.0.0.1"; if (std::getenv("GROUNDTRUTH_ADDR") != nullptr) { - CommandPortChar = std::getenv("GROUNDTRUTH_ADDR"); + GroundTruthAddr = std::getenv("GROUNDTRUTH_ADDR"); } const char* GroundTruthPort = "10000"; if (std::getenv("GROUNDTRUTH_PORT") != nullptr) { - CommandPortChar = std::getenv("GROUNDTRUTH_PORT"); + GroundTruthPort = std::getenv("GROUNDTRUTH_PORT"); } const char* Namespace = "simulator"; @@ -67,6 +67,8 @@ int main() LOG_S(INFO)<<"online:" << online; + LOG_S(INFO)<< "command port"<< CommandPortChar; + SimControl::SimControl sc(online,CommandPortChar,GroundTruthAddr,SimCore::UtilFunctions::StringToUShort(GroundTruthPort),Namespace);