Add disable domain port auto discovery by assignment client option.

This commit is contained in:
Kalila L 2021-06-21 13:22:48 -04:00
parent 78ab7a628d
commit 2d4da7ba71
8 changed files with 62 additions and 31 deletions

View file

@ -44,7 +44,8 @@ const long long ASSIGNMENT_REQUEST_INTERVAL_MSECS = 1 * 1000;
AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool, AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname, quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort, quint16 assignmentMonitorPort) : quint16 assignmentServerPort, quint16 assignmentMonitorPort,
bool disableDomainPortAutoDiscovery) :
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME) _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME)
{ {
LogUtils::init(); LogUtils::init();
@ -89,6 +90,13 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
_assignmentServerSocket.setObjectName("AssignmentServer"); _assignmentServerSocket.setObjectName("AssignmentServer");
nodeList->setAssignmentServerSocket(_assignmentServerSocket); nodeList->setAssignmentServerSocket(_assignmentServerSocket);
if (disableDomainPortAutoDiscovery == true) {
_disableDomainPortAutoDiscovery = disableDomainPortAutoDiscovery;
qCDebug(assignment_client) << "Disabling domain port auto discovery by the assignment client due to parsed command line parameter.";
}
nodeList->setDomainPortAutoDiscovery(_disableDomainPortAutoDiscovery);
qCDebug(assignment_client) << "Assignment server socket is" << _assignmentServerSocket; qCDebug(assignment_client) << "Assignment server socket is" << _assignmentServerSocket;
// call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required
@ -164,7 +172,7 @@ void AssignmentClient::setUpStatusToMonitor() {
void AssignmentClient::sendStatusPacketToACM() { void AssignmentClient::sendStatusPacketToACM() {
// tell the assignment client monitor what this assignment client is doing (if anything) // tell the assignment client monitor what this assignment client is doing (if anything)
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
quint8 assignmentType = Assignment::Type::AllTypes; quint8 assignmentType = Assignment::Type::AllTypes;
if (_currentAssignment) { if (_currentAssignment) {
@ -175,7 +183,7 @@ void AssignmentClient::sendStatusPacketToACM() {
statusPacket->write(_childAssignmentUUID.toRfc4122()); statusPacket->write(_childAssignmentUUID.toRfc4122());
statusPacket->writePrimitive(assignmentType); statusPacket->writePrimitive(assignmentType);
nodeList->sendPacket(std::move(statusPacket), _assignmentClientMonitorSocket); nodeList->sendPacket(std::move(statusPacket), _assignmentClientMonitorSocket);
} }
@ -185,7 +193,7 @@ void AssignmentClient::sendAssignmentRequest() {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
if (_assignmentServerHostname == "localhost") { if (_assignmentServerHostname == "localhost" && _disableDomainPortAutoDiscovery == false) {
// we want to check again for the local domain-server port in case the DS has restarted // we want to check again for the local domain-server port in case the DS has restarted
quint16 localAssignmentServerPort; quint16 localAssignmentServerPort;
if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) { if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) {
@ -270,10 +278,10 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa
void AssignmentClient::handleStopNodePacket(QSharedPointer<ReceivedMessage> message) { void AssignmentClient::handleStopNodePacket(QSharedPointer<ReceivedMessage> message) {
const HifiSockAddr& senderSockAddr = message->getSenderSockAddr(); const HifiSockAddr& senderSockAddr = message->getSenderSockAddr();
if (senderSockAddr.getAddress() == QHostAddress::LocalHost || if (senderSockAddr.getAddress() == QHostAddress::LocalHost ||
senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) {
qCDebug(assignment_client) << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode."; qCDebug(assignment_client) << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode.";
QCoreApplication::quit(); QCoreApplication::quit();
} else { } else {
@ -307,7 +315,7 @@ void AssignmentClient::handleAuthenticationRequest() {
void AssignmentClient::assignmentCompleted() { void AssignmentClient::assignmentCompleted() {
crash::annotations::setShutdownState(true); crash::annotations::setShutdownState(true);
// we expect that to be here the previous assignment has completely cleaned up // we expect that to be here the previous assignment has completely cleaned up
assert(_currentAssignment.isNull()); assert(_currentAssignment.isNull());
@ -328,6 +336,6 @@ void AssignmentClient::assignmentCompleted() {
nodeList->setOwnerType(NodeType::Unassigned); nodeList->setOwnerType(NodeType::Unassigned);
nodeList->reset("Assignment completed"); nodeList->reset("Assignment completed");
nodeList->resetNodeInterestSet(); nodeList->resetNodeInterestSet();
_isAssigned = false; _isAssigned = false;
} }

View file

@ -23,9 +23,9 @@ class AssignmentClient : public QObject {
Q_OBJECT Q_OBJECT
public: public:
AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool, AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname,
QUuid walletUUID, QString assignmentServerHostname, quint16 assignmentServerPort, quint16 assignmentServerPort, quint16 assignmentMonitorPort,
quint16 assignmentMonitorPort); bool disableDomainPortAutoDiscovery);
~AssignmentClient(); ~AssignmentClient();
private slots: private slots:
@ -53,6 +53,7 @@ private:
QTimer _requestTimer; // timer for requesting and assignment QTimer _requestTimer; // timer for requesting and assignment
QTimer _statsTimerACM; // timer for sending stats to assignment client monitor QTimer _statsTimerACM; // timer for sending stats to assignment client monitor
QUuid _childAssignmentUUID = QUuid::createUuid(); QUuid _childAssignmentUUID = QUuid::createUuid();
bool _disableDomainPortAutoDiscovery { false };
protected: protected:
HifiSockAddr _assignmentClientMonitorSocket; HifiSockAddr _assignmentClientMonitorSocket;

View file

@ -4,6 +4,7 @@
// //
// Created by Seth Alves on 2/19/15. // Created by Seth Alves on 2/19/15.
// Copyright 2015 High Fidelity, Inc. // Copyright 2015 High Fidelity, Inc.
// Copyright 2021 Vircadia contributors.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -44,7 +45,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
// parse command-line // parse command-line
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription("High Fidelity Assignment Client"); parser.setApplicationDescription("Vircadia Assignment Client");
const QCommandLineOption helpOption = parser.addHelpOption(); const QCommandLineOption helpOption = parser.addHelpOption();
const QCommandLineOption versionOption = parser.addVersionOption(); const QCommandLineOption versionOption = parser.addVersionOption();
@ -54,8 +55,8 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
type = static_cast<Assignment::Type>(static_cast<int>(type) + 1)) { type = static_cast<Assignment::Type>(static_cast<int>(type) + 1)) {
typeDescription.append(QStringLiteral("\n%1 | %2").arg(QString::number(type), Assignment::typeToString(type))); typeDescription.append(QStringLiteral("\n%1 | %2").arg(QString::number(type), Assignment::typeToString(type)));
} }
const QCommandLineOption clientTypeOption(ASSIGNMENT_TYPE_OVERRIDE_OPTION, typeDescription, "type");
const QCommandLineOption clientTypeOption(ASSIGNMENT_TYPE_OVERRIDE_OPTION, typeDescription, "type");
parser.addOption(clientTypeOption); parser.addOption(clientTypeOption);
const QCommandLineOption poolOption(ASSIGNMENT_POOL_OPTION, "set assignment pool", "pool-name"); const QCommandLineOption poolOption(ASSIGNMENT_POOL_OPTION, "set assignment pool", "pool-name");
@ -99,6 +100,9 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption logDirectoryOption(ASSIGNMENT_LOG_DIRECTORY, "directory to store logs", "log-directory"); const QCommandLineOption logDirectoryOption(ASSIGNMENT_LOG_DIRECTORY, "directory to store logs", "log-directory");
parser.addOption(logDirectoryOption); parser.addOption(logDirectoryOption);
const QCommandLineOption disableDomainPortAutoDiscoveryOption(ASSIGNMENT_DISABLE_DOMAIN_AUTO_PORT_DISCOVERY, "disable automatic discovery of the domain server port");
parser.addOption(disableDomainPortAutoDiscoveryOption);
const QCommandLineOption parentPIDOption(PARENT_PID_OPTION, "PID of the parent process", "parent-pid"); const QCommandLineOption parentPIDOption(PARENT_PID_OPTION, "PID of the parent process", "parent-pid");
parser.addOption(parentPIDOption); parser.addOption(parentPIDOption);
@ -151,11 +155,14 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
} }
QString logDirectory; QString logDirectory;
if (parser.isSet(logDirectoryOption)) { if (parser.isSet(logDirectoryOption)) {
logDirectory = parser.value(logDirectoryOption); logDirectory = parser.value(logDirectoryOption);
} }
bool disableDomainPortAutoDiscovery = false;
if (parser.isSet(disableDomainPortAutoDiscoveryOption)) {
disableDomainPortAutoDiscovery = true;
}
Assignment::Type requestAssignmentType = Assignment::AllTypes; Assignment::Type requestAssignmentType = Assignment::AllTypes;
if (argumentVariantMap.contains(ASSIGNMENT_TYPE_OVERRIDE_OPTION)) { if (argumentVariantMap.contains(ASSIGNMENT_TYPE_OVERRIDE_OPTION)) {
@ -250,13 +257,15 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
AssignmentClientMonitor* monitor = new AssignmentClientMonitor(numForks, minForks, maxForks, AssignmentClientMonitor* monitor = new AssignmentClientMonitor(numForks, minForks, maxForks,
requestAssignmentType, assignmentPool, listenPort, requestAssignmentType, assignmentPool, listenPort,
childMinListenPort, walletUUID, assignmentServerHostname, childMinListenPort, walletUUID, assignmentServerHostname,
assignmentServerPort, httpStatusPort, logDirectory); assignmentServerPort, httpStatusPort, logDirectory,
disableDomainPortAutoDiscovery);
monitor->setParent(this); monitor->setParent(this);
connect(this, &QCoreApplication::aboutToQuit, monitor, &AssignmentClientMonitor::aboutToQuit); connect(this, &QCoreApplication::aboutToQuit, monitor, &AssignmentClientMonitor::aboutToQuit);
} else { } else {
AssignmentClient* client = new AssignmentClient(requestAssignmentType, assignmentPool, listenPort, AssignmentClient* client = new AssignmentClient(requestAssignmentType, assignmentPool, listenPort,
walletUUID, assignmentServerHostname, walletUUID, assignmentServerHostname,
assignmentServerPort, monitorPort); assignmentServerPort, monitorPort,
disableDomainPortAutoDiscovery);
client->setParent(this); client->setParent(this);
connect(this, &QCoreApplication::aboutToQuit, client, &AssignmentClient::aboutToQuit); connect(this, &QCoreApplication::aboutToQuit, client, &AssignmentClient::aboutToQuit);
} }

View file

@ -4,6 +4,7 @@
// //
// Created by Seth Alves on 2/19/15. // Created by Seth Alves on 2/19/15.
// Copyright 2015 High Fidelity, Inc. // Copyright 2015 High Fidelity, Inc.
// Copyright 2021 Vircadia contributors.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -28,6 +29,7 @@ const QString ASSIGNMENT_MAX_FORKS_OPTION = "max";
const QString ASSIGNMENT_CLIENT_MONITOR_PORT_OPTION = "monitor-port"; const QString ASSIGNMENT_CLIENT_MONITOR_PORT_OPTION = "monitor-port";
const QString ASSIGNMENT_HTTP_STATUS_PORT = "http-status-port"; const QString ASSIGNMENT_HTTP_STATUS_PORT = "http-status-port";
const QString ASSIGNMENT_LOG_DIRECTORY = "log-directory"; const QString ASSIGNMENT_LOG_DIRECTORY = "log-directory";
const QString ASSIGNMENT_DISABLE_DOMAIN_AUTO_PORT_DISCOVERY = "disable-domain-port-auto-discovery";
class AssignmentClientApp : public QCoreApplication { class AssignmentClientApp : public QCoreApplication {
Q_OBJECT Q_OBJECT

View file

@ -4,6 +4,7 @@
// //
// Created by Stephen Birarda on 1/10/2014. // Created by Stephen Birarda on 1/10/2014.
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2021 Vircadia contributors.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -41,7 +42,8 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
const unsigned int maxAssignmentClientForks, const unsigned int maxAssignmentClientForks,
Assignment::Type requestAssignmentType, QString assignmentPool, Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID, QString assignmentServerHostname, quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort, quint16 httpStatusServerPort, QString logDirectory) : quint16 assignmentServerPort, quint16 httpStatusServerPort, QString logDirectory,
bool disableDomainPortAutoDiscovery) :
_httpManager(QHostAddress::LocalHost, httpStatusServerPort, "", this), _httpManager(QHostAddress::LocalHost, httpStatusServerPort, "", this),
_numAssignmentClientForks(numAssignmentClientForks), _numAssignmentClientForks(numAssignmentClientForks),
_minAssignmentClientForks(minAssignmentClientForks), _minAssignmentClientForks(minAssignmentClientForks),
@ -51,7 +53,8 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
_walletUUID(walletUUID), _walletUUID(walletUUID),
_assignmentServerHostname(assignmentServerHostname), _assignmentServerHostname(assignmentServerHostname),
_assignmentServerPort(assignmentServerPort), _assignmentServerPort(assignmentServerPort),
_childMinListenPort(childMinListenPort) _childMinListenPort(childMinListenPort),
_disableDomainPortAutoDiscovery(disableDomainPortAutoDiscovery)
{ {
qDebug() << "_requestAssignmentType =" << _requestAssignmentType; qDebug() << "_requestAssignmentType =" << _requestAssignmentType;
@ -198,6 +201,9 @@ void AssignmentClientMonitor::spawnChildClient() {
_childArguments.append("--" + ASSIGNMENT_TYPE_OVERRIDE_OPTION); _childArguments.append("--" + ASSIGNMENT_TYPE_OVERRIDE_OPTION);
_childArguments.append(QString::number(_requestAssignmentType)); _childArguments.append(QString::number(_requestAssignmentType));
} }
if (_disableDomainPortAutoDiscovery != false) {
_childArguments.append("--" + ASSIGNMENT_DISABLE_DOMAIN_AUTO_PORT_DISCOVERY);
}
if (listenPort) { if (listenPort) {
_childArguments.append("-" + ASSIGNMENT_CLIENT_LISTEN_PORT_OPTION); _childArguments.append("-" + ASSIGNMENT_CLIENT_LISTEN_PORT_OPTION);
@ -266,7 +272,7 @@ void AssignmentClientMonitor::spawnChildClient() {
stderrPath = stderrPathTemp; stderrPath = stderrPathTemp;
stderrFilename = stderrFilenameTemp; stderrFilename = stderrFilenameTemp;
} }
qDebug() << "Child stdout being written to: " << stdoutFilename; qDebug() << "Child stdout being written to: " << stdoutFilename;
qDebug() << "Child stderr being written to: " << stderrFilename; qDebug() << "Child stderr being written to: " << stderrFilename;
} }

View file

@ -4,6 +4,7 @@
// //
// Created by Stephen Birarda on 1/10/2014. // Created by Stephen Birarda on 1/10/2014.
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2021 Vircadia contributors.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -27,7 +28,7 @@
extern const char* NUM_FORKS_PARAMETER; extern const char* NUM_FORKS_PARAMETER;
struct ACProcess { struct ACProcess {
QProcess* process; // looks like a dangling pointer, but is parented by the AssignmentClientMonitor QProcess* process; // looks like a dangling pointer, but is parented by the AssignmentClientMonitor
QString logStdoutPath; QString logStdoutPath;
QString logStderrPath; QString logStderrPath;
}; };
@ -39,7 +40,7 @@ public:
const unsigned int maxAssignmentClientForks, Assignment::Type requestAssignmentType, const unsigned int maxAssignmentClientForks, Assignment::Type requestAssignmentType,
QString assignmentPool, quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID, QString assignmentPool, quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID,
QString assignmentServerHostname, quint16 assignmentServerPort, quint16 httpStatusServerPort, QString assignmentServerHostname, quint16 assignmentServerPort, quint16 httpStatusServerPort,
QString logDirectory); QString logDirectory, bool disableDomainPortAutoDiscovery);
~AssignmentClientMonitor(); ~AssignmentClientMonitor();
void stopChildProcesses(); void stopChildProcesses();
@ -80,6 +81,7 @@ private:
QSet<quint16> _childListenPorts; QSet<quint16> _childListenPorts;
bool _wantsChildFileLogging { false }; bool _wantsChildFileLogging { false };
bool _disableDomainPortAutoDiscovery { false };
}; };
#endif // hifi_AssignmentClientMonitor_h #endif // hifi_AssignmentClientMonitor_h

View file

@ -377,7 +377,7 @@ void NodeList::sendDomainServerCheckIn() {
// if so we need to make sure we have an up-to-date local port in case it restarted // if so we need to make sure we have an up-to-date local port in case it restarted
if (domainSockAddr.getAddress() == QHostAddress::LocalHost if (domainSockAddr.getAddress() == QHostAddress::LocalHost
|| hostname == "localhost") { || hostname == "localhost" && _domainPortAutoDiscovery == true) {
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT; quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, domainPort); getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, domainPort);
@ -534,7 +534,7 @@ void NodeList::sendDomainServerCheckIn() {
sendPacket(std::move(packetCopy), domainSockAddr); sendPacket(std::move(packetCopy), domainSockAddr);
} }
sendPacket(std::move(domainPacket), domainSockAddr); sendPacket(std::move(domainPacket), domainSockAddr);
} }
} }
@ -661,7 +661,7 @@ void NodeList::handleICEConnectionToDomainServer() {
_domainHandler.getICEClientID(), _domainHandler.getICEClientID(),
_domainHandler.getPendingDomainID()); _domainHandler.getPendingDomainID());
} }
} }
void NodeList::pingPunchForDomainServer() { void NodeList::pingPunchForDomainServer() {
// make sure if we're here that we actually still need to ping the domain-server // make sure if we're here that we actually still need to ping the domain-server
@ -713,7 +713,7 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<ReceivedM
void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) { void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) {
// parse header information // parse header information
QDataStream packetStream(message->getMessage()); QDataStream packetStream(message->getMessage());
// grab the domain's ID from the beginning of the packet // grab the domain's ID from the beginning of the packet
@ -794,7 +794,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) { if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) {
// Received packet from different domain. // Received packet from different domain.
qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to"
<< _domainHandler.getUUID() << ": sent " << pingLagTime << " msec ago."; << _domainHandler.getUUID() << ": sent " << pingLagTime << " msec ago.";
qWarning(networking) << "DomainList request lag (interface->ds): " << domainServerRequestLag << "msec"; qWarning(networking) << "DomainList request lag (interface->ds): " << domainServerRequestLag << "msec";
qWarning(networking) << "DomainList server processing time: " << domainServerCheckinProcessingTime << "usec"; qWarning(networking) << "DomainList server processing time: " << domainServerCheckinProcessingTime << "usec";
@ -821,9 +821,9 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
setSessionLocalID(newLocalID); setSessionLocalID(newLocalID);
setSessionUUID(newUUID); setSessionUUID(newUUID);
// FIXME: Remove this call to requestDomainSettings() and reinstate the one in DomainHandler::setIsConnected(), in version // FIXME: Remove this call to requestDomainSettings() and reinstate the one in DomainHandler::setIsConnected(), in version
// 2021.2.0. (New protocol version implies a domain server upgrade.) // 2021.2.0. (New protocol version implies a domain server upgrade.)
if (!_domainHandler.isConnected() if (!_domainHandler.isConnected()
&& _domainHandler.getScheme() == URL_SCHEME_HIFI && !_domainHandler.getHostname().isEmpty()) { && _domainHandler.getScheme() == URL_SCHEME_HIFI && !_domainHandler.getHostname().isEmpty()) {
// We're about to connect but we need the domain settings (in particular, the node permissions) in order to adjust the // We're about to connect but we need the domain settings (in particular, the node permissions) in order to adjust the
// canRezAvatarEntities permission above before using the permissions in determining whether or not to connect without // canRezAvatarEntities permission above before using the permissions in determining whether or not to connect without
@ -831,7 +831,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
_domainHandler.requestDomainSettings(); _domainHandler.requestDomainSettings();
} }
// Don't continue login to the domain if have avatar entities and don't have permissions to rez them, unless user has OKed // Don't continue login to the domain if have avatar entities and don't have permissions to rez them, unless user has OKed
// continuing login. // continuing login.
if (!newPermissions.can(NodePermissions::Permission::canRezAvatarEntities) if (!newPermissions.can(NodePermissions::Permission::canRezAvatarEntities)
&& (!adjustedPermissions || !_domainHandler.canConnectWithoutAvatarEntities())) { && (!adjustedPermissions || !_domainHandler.canConnectWithoutAvatarEntities())) {
@ -920,7 +920,7 @@ void NodeList::pingPunchForInactiveNode(const SharedNodePointer& node) {
if (node->getConnectionAttempts() > 0 && node->getConnectionAttempts() % NUM_DEBUG_CONNECTION_ATTEMPTS == 0) { if (node->getConnectionAttempts() > 0 && node->getConnectionAttempts() % NUM_DEBUG_CONNECTION_ATTEMPTS == 0) {
qCDebug(networking) << "No response to UDP hole punch pings for node" << node->getUUID() << "in last 2 s."; qCDebug(networking) << "No response to UDP hole punch pings for node" << node->getUUID() << "in last 2 s.";
} }
auto nodeID = node->getUUID(); auto nodeID = node->getUUID();
// send the ping packet to the local and public sockets for this node // send the ping packet to the local and public sockets for this node

View file

@ -70,6 +70,8 @@ public:
void setAssignmentServerSocket(const HifiSockAddr& serverSocket) { _assignmentServerSocket = serverSocket; } void setAssignmentServerSocket(const HifiSockAddr& serverSocket) { _assignmentServerSocket = serverSocket; }
void sendAssignment(Assignment& assignment); void sendAssignment(Assignment& assignment);
void setDomainPortAutoDiscovery(bool enabled = true) { _domainPortAutoDiscovery = enabled; };
void setIsShuttingDown(bool isShuttingDown) { _isShuttingDown = isShuttingDown; } void setIsShuttingDown(bool isShuttingDown) { _isShuttingDown = isShuttingDown; }
void ignoreNodesInRadius(bool enabled = true); void ignoreNodesInRadius(bool enabled = true);
@ -105,7 +107,7 @@ public:
public slots: public slots:
void reset(QString reason, bool skipDomainHandlerReset = false); void reset(QString reason, bool skipDomainHandlerReset = false);
void resetFromDomainHandler() { reset("Reset from Domain Handler", true); } void resetFromDomainHandler() { reset("Reset from Domain Handler", true); }
void sendDomainServerCheckIn(); void sendDomainServerCheckIn();
void handleDSPathQuery(const QString& newPath); void handleDSPathQuery(const QString& newPath);
@ -180,6 +182,7 @@ private:
bool _requestsDomainListData { false }; bool _requestsDomainListData { false };
bool _sendDomainServerCheckInEnabled { true }; bool _sendDomainServerCheckInEnabled { true };
bool _domainPortAutoDiscovery { true };
mutable QReadWriteLock _ignoredSetLock; mutable QReadWriteLock _ignoredSetLock;
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs; tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;