History

Add disable domain port auto discovery by assignment client option.

Kalila L committed 5 years ago

Commit 2d4da7b1 parent 78ab7a68 files · +62 −31Browse files

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

Unified · Split

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