mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-09 00:08:19 +02:00
add TODO for settings fail, cleanup
This commit is contained in:
parent
e84595af49
commit
f7799bcf8f
5 changed files with 7 additions and 37 deletions
|
@ -667,6 +667,8 @@ void AudioMixer::run() {
|
||||||
domainHandler.requestDomainSettings();
|
domainHandler.requestDomainSettings();
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
|
domainHandler.requestDomainSettings();
|
||||||
|
|
||||||
if (domainHandler.getSettingsObject().isEmpty()) {
|
if (domainHandler.getSettingsObject().isEmpty()) {
|
||||||
qDebug() << "Failed to retreive settings object from domain-server. Bailing on assignment.";
|
qDebug() << "Failed to retreive settings object from domain-server. Bailing on assignment.";
|
||||||
setFinished(true);
|
setFinished(true);
|
||||||
|
|
|
@ -227,6 +227,9 @@ void DomainHandler::setIsConnected(bool isConnected) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainHandler::requestDomainSettings() {
|
void DomainHandler::requestDomainSettings() {
|
||||||
|
// TODO: the nodes basically lock if they don't get a response - add a timeout to this so that they at least restart
|
||||||
|
// if they can't get settings
|
||||||
|
|
||||||
NodeType_t owningNodeType = DependencyManager::get<NodeList>()->getOwnerType();
|
NodeType_t owningNodeType = DependencyManager::get<NodeList>()->getOwnerType();
|
||||||
if (owningNodeType == NodeType::Agent) {
|
if (owningNodeType == NodeType::Agent) {
|
||||||
// for now the agent nodes don't need any settings - this allows local assignment-clients
|
// for now the agent nodes don't need any settings - this allows local assignment-clients
|
||||||
|
@ -248,40 +251,6 @@ void DomainHandler::requestDomainSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS = 5;
|
|
||||||
|
|
||||||
void DomainHandler::settingsRequestFinished() {
|
|
||||||
QNetworkReply* settingsReply = reinterpret_cast<QNetworkReply*>(sender());
|
|
||||||
|
|
||||||
int replyCode = settingsReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
|
||||||
|
|
||||||
if (settingsReply->error() == QNetworkReply::NoError && replyCode != 301 && replyCode != 302) {
|
|
||||||
// parse the JSON to a QJsonObject and save it
|
|
||||||
_settingsObject = QJsonDocument::fromJson(settingsReply->readAll()).object();
|
|
||||||
|
|
||||||
qCDebug(networking) << "Received domain settings.";
|
|
||||||
emit settingsReceived(_settingsObject);
|
|
||||||
|
|
||||||
// reset failed settings requests to 0, we got them
|
|
||||||
_failedSettingsRequests = 0;
|
|
||||||
} else {
|
|
||||||
// error grabbing the settings - in some cases this means we are stuck
|
|
||||||
// so we should retry until we get it
|
|
||||||
qCDebug(networking) << "Error getting domain settings -" << settingsReply->errorString() << "- retrying";
|
|
||||||
|
|
||||||
if (++_failedSettingsRequests >= MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS) {
|
|
||||||
qCDebug(networking) << "Failed to retreive domain-server settings" << MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS
|
|
||||||
<< "times. Re-setting connection to domain.";
|
|
||||||
clearSettings();
|
|
||||||
clearConnectionInfo();
|
|
||||||
emit settingsReceiveFail();
|
|
||||||
} else {
|
|
||||||
requestDomainSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
settingsReply->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DomainHandler::processSettingsPacketList(QSharedPointer<NLPacketList> packetList) {
|
void DomainHandler::processSettingsPacketList(QSharedPointer<NLPacketList> packetList) {
|
||||||
auto data = packetList->getMessage();
|
auto data = packetList->getMessage();
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,6 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void completedHostnameLookup(const QHostInfo& hostInfo);
|
void completedHostnameLookup(const QHostInfo& hostInfo);
|
||||||
void completedIceServerHostnameLookup();
|
void completedIceServerHostnameLookup();
|
||||||
void settingsRequestFinished();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void hostnameChanged(const QString& hostname);
|
void hostnameChanged(const QString& hostname);
|
||||||
|
|
|
@ -330,7 +330,7 @@ void SendQueue::run() {
|
||||||
// both are empty - let's use a condition_variable_any to wait
|
// both are empty - let's use a condition_variable_any to wait
|
||||||
_emptyCondition.wait(doubleLock);
|
_emptyCondition.wait(doubleLock);
|
||||||
|
|
||||||
// we have the double lock again - it'll be unlock once it goes out of scope
|
// we have the double lock again - it'll be unlocked once it goes out of scope
|
||||||
// skip to the next iteration
|
// skip to the next iteration
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
|
|
||||||
MessageNumber _currentMessageNumber { 0 };
|
MessageNumber _currentMessageNumber { 0 };
|
||||||
SequenceNumber _currentSequenceNumber; // Last sequence number sent out
|
SequenceNumber _currentSequenceNumber; // Last sequence number sent out
|
||||||
std::atomic<uint32_t> _atomicCurrentSequenceNumber;// Atomic for last sequence number sent out
|
std::atomic<uint32_t> _atomicCurrentSequenceNumber { 0 };// Atomic for last sequence number sent out
|
||||||
|
|
||||||
std::atomic<int> _packetSendPeriod; // Interval between two packet send event in microseconds, set from CC
|
std::atomic<int> _packetSendPeriod; // Interval between two packet send event in microseconds, set from CC
|
||||||
std::chrono::high_resolution_clock::time_point _lastSendTimestamp; // Record last time of packet departure
|
std::chrono::high_resolution_clock::time_point _lastSendTimestamp; // Record last time of packet departure
|
||||||
|
|
Loading…
Reference in a new issue