Skip to content

Commit

Permalink
Moved network initialization before the connection of ports in IWearR…
Browse files Browse the repository at this point in the history
…emapper
  • Loading branch information
S-Dafarra committed Sep 10, 2024
1 parent eccaa68 commit 77c8b8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions devices/IWearRemapper/src/IWearRemapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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) {
Expand Down

0 comments on commit 77c8b8f

Please sign in to comment.