History

network chatter between Monitor and AssignmentClients is expected to be localhost only

Seth Alves committed 11 years ago

Commit 8cee88a1 parent 70c96e42 files · +23 −14Browse files

Showing the changes to assignment-client/src/AssignmentClientMonitor.cpp (1 of 2 files). Show all

Unified · Split

assignment-client/src/AssignmentClientMonitor.cpp+16−12
@@ -87,10 +87,12 @@ void AssignmentClientMonitor::spawnChildClient() { · 86 unmodified lines
8787 assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);
8888
8989 assignmentClient->start(applicationFilePath(), _childArguments);
90+
9091 qDebug() << "Spawned a child client with PID" << assignmentClient->pid();
9192 }
9293
9394
95+
9496 void AssignmentClientMonitor::checkSpares() {
9597 auto nodeList = DependencyManager::get<NodeList>();
9698 QUuid aSpareId = "";
@@ -100,7 +102,6 @@ void AssignmentClientMonitor::checkSpares() { · 3 unmodified lines
100102
101103 nodeList->eachNode([&](const SharedNodePointer& node){
102104 AssignmentClientChildData *childData = static_cast<AssignmentClientChildData*>(node->getLinkedData());
103− qDebug() << " " << node->getUUID() << childData->getChildType();
104105 if (childData->getChildType() == "none") {
105106 spareCount ++;
106107 aSpareId = node->getUUID();
@@ -142,17 +143,20 @@ void AssignmentClientMonitor::readPendingDatagrams() { · 35 unmodified lines
142143 QUuid packetUUID = uuidFromPacketHeader(receivedPacket);
143144 SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket);
144145 if (!matchingNode) {
145− // XXX only do this if from local machine
146− if (!packetUUID.isNull()) {
147− matchingNode = DependencyManager::get<LimitedNodeList>()->addOrUpdateNode
148− (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false);
149− AssignmentClientChildData *childData = new AssignmentClientChildData("unknown");
150− matchingNode->setLinkedData(childData);
151− } else {
152− // tell unknown assignment-client child to exit.
153− qDebug() << "asking unknown child to exit.";
154− QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
155− nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr);
146+ // The parent only expects to be talking with prorams running on this same machine.
147+ if (senderSockAddr.getAddress() == QHostAddress::LocalHost ||
148+ senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) {
149+ if (!packetUUID.isNull()) {
150+ matchingNode = DependencyManager::get<LimitedNodeList>()->addOrUpdateNode
151+ (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false);
152+ AssignmentClientChildData *childData = new AssignmentClientChildData("unknown");
153+ matchingNode->setLinkedData(childData);
154+ } else {
155+ // tell unknown assignment-client child to exit.
156+ qDebug() << "asking unknown child to exit.";
157+ QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
158+ nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr);
159+ }
156160 }
157161 }
158162

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t