Showing the changes to assignment-client/src/AssignmentClient.cpp (1 of 8 files). Show all
Unified · Split
| @@ -44,7 +44,8 @@ const long long ASSIGNMENT_REQUEST_INTERVAL_MSECS = 1 * 1000; · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool, |
| 46 | 46 | quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname, |
| 47 | − quint16 assignmentServerPort, quint16 assignmentMonitorPort) : | |
| 47 | + quint16 assignmentServerPort, quint16 assignmentMonitorPort, | |
| 48 | + bool disableDomainPortAutoDiscovery) : | |
| 48 | 49 | _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME) |
| 49 | 50 | { |
| 50 | 51 | LogUtils::init(); |
| @@ -89,6 +90,13 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri · 38 unmodified lines | ||
| 89 | 90 | _assignmentServerSocket.setObjectName("AssignmentServer"); |
| 90 | 91 | nodeList->setAssignmentServerSocket(_assignmentServerSocket); |
| 91 | 92 | |
| 93 | + if (disableDomainPortAutoDiscovery == true) { | |
| 94 | + _disableDomainPortAutoDiscovery = disableDomainPortAutoDiscovery; | |
| 95 | + qCDebug(assignment_client) << "Disabling domain port auto discovery by the assignment client due to parsed command line parameter."; | |
| 96 | + } | |
| 97 | + | |
| 98 | + nodeList->setDomainPortAutoDiscovery(_disableDomainPortAutoDiscovery); | |
| 99 | + | |
| 92 | 100 | qCDebug(assignment_client) << "Assignment server socket is" << _assignmentServerSocket; |
| 93 | 101 | |
| 94 | 102 | // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required |
| @@ -164,7 +172,7 @@ void AssignmentClient::setUpStatusToMonitor() { · 69 unmodified lines | ||
| 164 | 172 | void AssignmentClient::sendStatusPacketToACM() { |
| 165 | 173 | // tell the assignment client monitor what this assignment client is doing (if anything) |
| 166 | 174 | auto nodeList = DependencyManager::get<NodeList>(); |
| 167 | − | |
| 175 | + | |
| 168 | 176 | quint8 assignmentType = Assignment::Type::AllTypes; |
| 169 | 177 | |
| 170 | 178 | if (_currentAssignment) { |
| @@ -175,7 +183,7 @@ void AssignmentClient::sendStatusPacketToACM() { · 4 unmodified lines | ||
| 175 | 183 | |
| 176 | 184 | statusPacket->write(_childAssignmentUUID.toRfc4122()); |
| 177 | 185 | statusPacket->writePrimitive(assignmentType); |
| 178 | − | |
| 186 | + | |
| 179 | 187 | nodeList->sendPacket(std::move(statusPacket), _assignmentClientMonitorSocket); |
| 180 | 188 | } |
| 181 | 189 | |
| @@ -185,7 +193,7 @@ void AssignmentClient::sendAssignmentRequest() { · 3 unmodified lines | ||
| 185 | 193 | |
| 186 | 194 | auto nodeList = DependencyManager::get<NodeList>(); |
| 187 | 195 | |
| 188 | − if (_assignmentServerHostname == "localhost") { | |
| 196 | + if (_assignmentServerHostname == "localhost" && _disableDomainPortAutoDiscovery == false) { | |
| 189 | 197 | // we want to check again for the local domain-server port in case the DS has restarted |
| 190 | 198 | quint16 localAssignmentServerPort; |
| 191 | 199 | if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) { |
| @@ -270,10 +278,10 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa · 78 unmodified lines | ||
| 270 | 278 | |
| 271 | 279 | void AssignmentClient::handleStopNodePacket(QSharedPointer<ReceivedMessage> message) { |
| 272 | 280 | const HifiSockAddr& senderSockAddr = message->getSenderSockAddr(); |
| 273 | − | |
| 281 | + | |
| 274 | 282 | if (senderSockAddr.getAddress() == QHostAddress::LocalHost || |
| 275 | 283 | senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { |
| 276 | − | |
| 284 | + | |
| 277 | 285 | qCDebug(assignment_client) << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode."; |
| 278 | 286 | QCoreApplication::quit(); |
| 279 | 287 | } else { |
| @@ -307,7 +315,7 @@ void AssignmentClient::handleAuthenticationRequest() { · 27 unmodified lines | ||
| 307 | 315 | |
| 308 | 316 | void AssignmentClient::assignmentCompleted() { |
| 309 | 317 | crash::annotations::setShutdownState(true); |
| 310 | − | |
| 318 | + | |
| 311 | 319 | // we expect that to be here the previous assignment has completely cleaned up |
| 312 | 320 | assert(_currentAssignment.isNull()); |
| 313 | 321 | |
| @@ -328,6 +336,6 @@ void AssignmentClient::assignmentCompleted() { · 14 unmodified lines | ||
| 328 | 336 | nodeList->setOwnerType(NodeType::Unassigned); |
| 329 | 337 | nodeList->reset("Assignment completed"); |
| 330 | 338 | nodeList->resetNodeInterestSet(); |
| 331 | − | |
| 339 | + | |
| 332 | 340 | _isAssigned = false; |
| 333 | 341 | } |