Showing the changes to assignment-client/src/AssignmentClientMonitor.cpp (1 of 2 files). Show all
Unified · Split
| @@ -87,10 +87,12 @@ void AssignmentClientMonitor::spawnChildClient() { · 86 unmodified lines | |||
| 87 | assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); | 87 | assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); |
| 88 | 88 | ||
| 89 | assignmentClient->start(applicationFilePath(), _childArguments); | 89 | assignmentClient->start(applicationFilePath(), _childArguments); |
| 90 | |||
| 90 | qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); | 91 | qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | 94 | ||
| 95 | |||
| 94 | void AssignmentClientMonitor::checkSpares() { | 96 | void AssignmentClientMonitor::checkSpares() { |
| 95 | auto nodeList = DependencyManager::get<NodeList>(); | 97 | auto nodeList = DependencyManager::get<NodeList>(); |
| 96 | QUuid aSpareId = ""; | 98 | QUuid aSpareId = ""; |
| @@ -100,7 +102,6 @@ void AssignmentClientMonitor::checkSpares() { · 3 unmodified lines | |||
| 100 | 102 | ||
| 101 | nodeList->eachNode([&](const SharedNodePointer& node){ | 103 | nodeList->eachNode([&](const SharedNodePointer& node){ |
| 102 | AssignmentClientChildData *childData = static_cast<AssignmentClientChildData*>(node->getLinkedData()); | 104 | AssignmentClientChildData *childData = static_cast<AssignmentClientChildData*>(node->getLinkedData()); |
| 103 | qDebug() << " " << node->getUUID() << childData->getChildType(); | ||
| 104 | if (childData->getChildType() == "none") { | 105 | if (childData->getChildType() == "none") { |
| 105 | spareCount ++; | 106 | spareCount ++; |
| 106 | aSpareId = node->getUUID(); | 107 | aSpareId = node->getUUID(); |
| @@ -142,17 +143,20 @@ void AssignmentClientMonitor::readPendingDatagrams() { · 35 unmodified lines | |||
| 142 | QUuid packetUUID = uuidFromPacketHeader(receivedPacket); | 143 | QUuid packetUUID = uuidFromPacketHeader(receivedPacket); |
| 143 | SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); | 144 | SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); |
| 144 | if (!matchingNode) { | 145 | if (!matchingNode) { |
| 145 | // XXX only do this if from local machine | 146 | // The parent only expects to be talking with prorams running on this same machine. |
| 146 | if (!packetUUID.isNull()) { | 147 | if (senderSockAddr.getAddress() == QHostAddress::LocalHost || |
| 147 | matchingNode = DependencyManager::get<LimitedNodeList>()->addOrUpdateNode | 148 | senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { |
| 148 | (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); | 149 | if (!packetUUID.isNull()) { |
| 149 | AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); | 150 | matchingNode = DependencyManager::get<LimitedNodeList>()->addOrUpdateNode |
| 150 | matchingNode->setLinkedData(childData); | 151 | (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); |
| 151 | } else { | 152 | AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); |
| 152 | // tell unknown assignment-client child to exit. | 153 | matchingNode->setLinkedData(childData); |
| 153 | qDebug() << "asking unknown child to exit."; | 154 | } else { |
| 154 | QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); | 155 | // tell unknown assignment-client child to exit. |
| 155 | nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); | 156 | qDebug() << "asking unknown child to exit."; |
| 157 | QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); | ||
| 158 | nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); | ||
| 159 | } | ||
| 156 | } | 160 | } |
| 157 | } | 161 | } |
| 158 | 162 | ||