From ea38c4cc49e90b98f9ccf92d9634a69658b5ebb6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 12 Nov 2015 18:04:15 -0800 Subject: [PATCH] don't allow domain check-ins while shutting down --- interface/src/Application.cpp | 3 ++- libraries/networking/src/NodeList.cpp | 4 ++++ libraries/networking/src/NodeList.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f8d958c82e..37ea5405da 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -836,8 +836,9 @@ void Application::cleanupBeforeQuit() { auto nodeList = DependencyManager::get(); - // send the domain a disconnect packet, force a clear of the IP so we can't + // send the domain a disconnect packet, force stoppage of domain-server check-ins nodeList->getDomainHandler().disconnect(); + nodeList->setIsShuttingDown(true); // tell the packet receiver we're shutting down, so it can drop packets nodeList->getPacketReceiver().setShouldDropPackets(true); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 19ed8073c1..e03ac47854 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -219,6 +219,10 @@ void NodeList::addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes) } void NodeList::sendDomainServerCheckIn() { + if (_isShuttingDown) { + qCDebug(networking) << "Refusing to send a domain-server check in while shutting down."; + } + if (_publicSockAddr.isNull()) { // we don't know our public socket and we need to send it to the domain server qCDebug(networking) << "Waiting for inital public socket from STUN. Will not send domain-server check in."; diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index 880f9b05f9..5b9a4e5ae5 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -66,6 +66,8 @@ public: void setAssignmentServerSocket(const HifiSockAddr& serverSocket) { _assignmentServerSocket = serverSocket; } void sendAssignment(Assignment& assignment); + + void setIsShuttingDown(bool isShuttingDown) { _isShuttingDown = isShuttingDown; } public slots: void reset(); @@ -115,6 +117,7 @@ private: DomainHandler _domainHandler; int _numNoReplyDomainCheckIns; HifiSockAddr _assignmentServerSocket; + bool _isShuttingDown { false }; }; #endif // hifi_NodeList_h