From ce3d6d2fca0de3eaf6fef0e69ce3b84c66b0f9a0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 25 Feb 2014 13:07:39 -0800 Subject: [PATCH] reset nodelist if domain-server stops talking to you, closes #2092 --- interface/src/Application.cpp | 1 + libraries/shared/src/NodeList.cpp | 6 ++++++ libraries/shared/src/NodeList.h | 1 + 3 files changed, 8 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 035845eda4..03905a45c1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -227,6 +227,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer))); connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer))); connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle); + connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset); // connect to appropriate slots on AccountManager AccountManager& accountManager = AccountManager::getInstance(); diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 98387ce420..d8c6cd09f1 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -549,6 +549,12 @@ void NodeList::sendDomainServerCheckIn() { sendSTUNRequest(); } + if (_numNoReplyDomainCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) { + // we haven't heard back from DS in MAX_SILENT_DOMAIN_SERVER_CHECK_INS + // so emit our signal that indicates that + emit limitOfSilentDomainCheckInsReached(); + } + // increment the count of un-replied check-ins _numNoReplyDomainCheckIns++; } else if (AccountManager::getInstance().hasValidAccessToken()) { diff --git a/libraries/shared/src/NodeList.h b/libraries/shared/src/NodeList.h index a66bcf3535..590a2ce83f 100644 --- a/libraries/shared/src/NodeList.h +++ b/libraries/shared/src/NodeList.h @@ -132,6 +132,7 @@ signals: void uuidChanged(const QUuid& ownerUUID); void nodeAdded(SharedNodePointer); void nodeKilled(SharedNodePointer); + void limitOfSilentDomainCheckInsReached(); private slots: void domainServerAuthReply(const QJsonObject& jsonObject); private: