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
380 380
381 // start the nodeThread so its event loop is running381 // start the nodeThread so its event loop is running
382 QThread* nodeThread = new QThread(this);382 QThread* nodeThread = new QThread(this);
383 nodeThread->setObjectName("Datagram Processor Thread");383 nodeThread->setObjectName("NodeList Thread");
384 nodeThread->start();384 nodeThread->start();
385 385
386 // make sure the node thread is given highest priority386 // make sure the node thread is given highest priority
387 nodeThread->setPriority(QThread::TimeCriticalPriority);387 nodeThread->setPriority(QThread::TimeCriticalPriority);
388 388
389 // have the NodeList use deleteLater from DM customDeleter
390 nodeList->setCustomDeleter([](Dependency* dependency) {
391 static_cast<NodeList*>(dependency)->deleteLater();
392 });
393
394 // setup a timer for domain-server check ins389 // setup a timer for domain-server check ins
395 QTimer* domainCheckInTimer = new QTimer(nodeList.data());390 QTimer* domainCheckInTimer = new QTimer(nodeList.data());
396 connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);391 connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
@@ -668,12 +663,11 @@ void Application::aboutToQuit() { · 271 unmodified lines
668 663
669void Application::cleanupBeforeQuit() {664void Application::cleanupBeforeQuit() {
670 665
671 // stop handling packets we've asked to handle
672 DependencyManager::get<LimitedNodeList>()->getPacketReceiver().unregisterListener(this);
673
674 _entities.clear(); // this will allow entity scripts to properly shutdown666 _entities.clear(); // this will allow entity scripts to properly shutdown
675 667
676 //_datagramProcessor->shutdown(); // tell the datagram processor we're shutting down, so it can short circuit668 // tell the packet receiver we're shutting down, so it can drop packets
669 DependencyManager::get<NodeList>()->getPacketReceiver().setShouldDropPackets(true);
670
677 _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts671 _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
678 ScriptEngine::stopAllScripts(this); // stop all currently running global scripts672 ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
679 673
@@ -748,6 +742,8 @@ Application::~Application() { · 68 unmodified lines
748 DependencyManager::destroy<SoundCache>();742 DependencyManager::destroy<SoundCache>();
749 743
750 QThread* nodeThread = DependencyManager::get<NodeList>()->thread();744 QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
745
746 // remove the NodeList from the DependencyManager
751 DependencyManager::destroy<NodeList>();747 DependencyManager::destroy<NodeList>();
752 748
753 // ask the node thread to quit and wait until it is done749 // ask the node thread to quit and wait until it is done
@@ -1801,7 +1797,6 @@ void Application::checkFPS() { · 1047 unmodified lines
1801 1797
1802 _fps = (float)_frameCount / diffTime;1798 _fps = (float)_frameCount / diffTime;
1803 _frameCount = 0;1799 _frameCount = 0;
1804 //_datagramProcessor->resetCounters();
1805 _timerStart.start();1800 _timerStart.start();
1806}1801}
1807 1802