History

Merge branch 'atp' of github.com:birarda/hifi into receive_packets

Ryan Huffman committed 11 years ago

Commit bd345cd2 parents e99df5b 5edb80916 files · +97 −198Browse files

Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all

Unified · Split

interface/src/Application.cpp+7−12
@@ -380,17 +380,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 379 unmodified lines
380380
381381 // start the nodeThread so its event loop is running
382382 QThread* nodeThread = new QThread(this);
383− nodeThread->setObjectName("Datagram Processor Thread");
383+ nodeThread->setObjectName("NodeList Thread");
384384 nodeThread->start();
385385
386386 // make sure the node thread is given highest priority
387387 nodeThread->setPriority(QThread::TimeCriticalPriority);
388388
389− // have the NodeList use deleteLater from DM customDeleter
390− nodeList->setCustomDeleter([](Dependency* dependency) {
391− static_cast<NodeList*>(dependency)->deleteLater();
392− });
393−
394389 // setup a timer for domain-server check ins
395390 QTimer* domainCheckInTimer = new QTimer(nodeList.data());
396391 connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
@@ -668,12 +663,11 @@ void Application::aboutToQuit() { · 271 unmodified lines
668663
669664 void Application::cleanupBeforeQuit() {
670665
671− // stop handling packets we've asked to handle
672− DependencyManager::get<LimitedNodeList>()->getPacketReceiver().unregisterListener(this);
673−
674666 _entities.clear(); // this will allow entity scripts to properly shutdown
675−
676− //_datagramProcessor->shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
667+
668+ // tell the packet receiver we're shutting down, so it can drop packets
669+ DependencyManager::get<NodeList>()->getPacketReceiver().setShouldDropPackets(true);
670+
677671 _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
678672 ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
679673
@@ -748,6 +742,8 @@ Application::~Application() { · 68 unmodified lines
748742 DependencyManager::destroy<SoundCache>();
749743
750744 QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
745+
746+ // remove the NodeList from the DependencyManager
751747 DependencyManager::destroy<NodeList>();
752748
753749 // ask the node thread to quit and wait until it is done
@@ -1801,7 +1797,6 @@ void Application::checkFPS() { · 1047 unmodified lines
18011797
18021798 _fps = (float)_frameCount / diffTime;
18031799 _frameCount = 0;
1804− //_datagramProcessor->resetCounters();
18051800 _timerStart.start();
18061801 }
18071802