From 77c8b8f41c1e142dd277c6539b884f4c37b9ff80 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 10 Sep 2024 12:43:53 +0200 Subject: [PATCH] Moved network initialization before the connection of ports in IWearRemapper --- devices/IWearRemapper/src/IWearRemapper.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/devices/IWearRemapper/src/IWearRemapper.cpp b/devices/IWearRemapper/src/IWearRemapper.cpp index e078d3e..2c7d80b 100644 --- a/devices/IWearRemapper/src/IWearRemapper.cpp +++ b/devices/IWearRemapper/src/IWearRemapper.cpp @@ -268,6 +268,13 @@ bool IWearRemapper::open(yarp::os::Searchable& config) // ================ yDebug() << logPrefix << "Opening input ports"; + // Initialize the network + pImpl->network = yarp::os::Network(); + if (!yarp::os::Network::initialized() || !yarp::os::Network::checkNetwork(5.0)) { + yError() << logPrefix << "YARP server wasn't found active."; + return false; + } + for (unsigned i = 0; i < inputDataPortsNamesList->size(); ++i) { if (!yarp::os::Network::connect(inputDataPortsNamesVector[i], pImpl->inputPortsWearData[i]->getName(), @@ -278,13 +285,6 @@ bool IWearRemapper::open(yarp::os::Searchable& config) } } - // Initialize the network - pImpl->network = yarp::os::Network(); - if (!yarp::os::Network::initialized() || !yarp::os::Network::checkNetwork(5.0)) { - yError() << logPrefix << "YARP server wasn't found active."; - return false; - } - // If it not necessary to wait for the attachAll start the callbacks // We use callbacks on the input ports, the loop is a no-op if (!pImpl->waitForAttachAll) {