don't require settings request for agent nodes

This commit is contained in:
Stephen Birarda 2014-10-03 09:37:13 -07:00
parent c96e7f72f8
commit 63024663b2
2 changed files with 24 additions and 16 deletions

View file

@ -185,7 +185,14 @@ void DomainHandler::setIsConnected(bool isConnected) {
}
}
void DomainHandler::requestDomainSettings() const {
void DomainHandler::requestDomainSettings() {
NodeType_t owningNodeType = NodeList::getInstance()->getOwnerType();
if (owningNodeType == NodeType::Agent) {
// for now the agent nodes don't need any settings - this allows local assignment-clients
// to connect to a domain that is using automatic networking (since we don't have TCP hole punch yet)
_settingsObject = QJsonObject();
emit settingsReceived(_settingsObject);
} else {
if (_settingsObject.isEmpty()) {
// setup the URL required to grab settings JSON
QUrl settingsJSONURL;
@ -201,6 +208,7 @@ void DomainHandler::requestDomainSettings() const {
QNetworkReply* reply = NetworkAccessManager::getInstance().get(QNetworkRequest(settingsJSONURL));
connect(reply, &QNetworkReply::finished, this, &DomainHandler::settingsRequestFinished);
}
}
}
const int MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS = 5;

View file

@ -67,7 +67,7 @@ public:
void setIsConnected(bool isConnected);
bool hasSettings() const { return !_settingsObject.isEmpty(); }
void requestDomainSettings() const;
void requestDomainSettings();
const QJsonObject& getSettingsObject() const { return _settingsObject; }
void parseDTLSRequirementPacket(const QByteArray& dtlsRequirementPacket);