Showing the changes to interface/src/Application.cpp (1 of 44 files). Show all
Unified · Split
| @@ -128,7 +128,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 127 unmodified lines | ||
| 128 | 128 | _perfStatsOn(false), |
| 129 | 129 | _chatEntryOn(false), |
| 130 | 130 | _audio(&_audioScope, STARTUP_JITTER_SAMPLES), |
| 131 | − _stopNetworkReceiveThread(false), | |
| 131 | + _enableProcessVoxelsThread(true), | |
| 132 | 132 | _voxelProcessor(), |
| 133 | 133 | _voxelHideShowThread(&_voxels), |
| 134 | 134 | _voxelEditSender(this), |
| @@ -165,6 +165,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 30 unmodified lines | ||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort); |
| 168 | + | |
| 169 | + // connect our processDatagrams slot to the QUDPSocket readyRead() signal | |
| 170 | + connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(processDatagrams())); | |
| 168 | 171 | |
| 169 | 172 | // put the audio processing on a separate thread |
| 170 | 173 | QThread* audioThread = new QThread(this); |
| @@ -173,14 +176,13 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 2 unmodified lines | ||
| 173 | 176 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); |
| 174 | 177 | |
| 175 | 178 | audioThread->start(); |
| 176 | − | |
| 177 | − nodeList->addHook(&_voxels); | |
| 178 | − nodeList->addHook(this); | |
| 179 | + | |
| 180 | + connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); | |
| 181 | + connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer))); | |
| 182 | + connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer))); | |
| 183 | + | |
| 179 | 184 | nodeList->addDomainListener(this); |
| 180 | 185 | |
| 181 | − // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line | |
| 182 | − _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking"); | |
| 183 | − | |
| 184 | 186 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 185 | 187 | QSettings applicationInfo("resources/info/ApplicationInfo.ini", QSettings::IniFormat); |
| 186 | 188 | |
| @@ -263,8 +265,6 @@ Application::~Application() { · 76 unmodified lines | ||
| 263 | 265 | _audio.thread()->wait(); |
| 264 | 266 | |
| 265 | 267 | storeSizeAndPosition(); |
| 266 | − NodeList::getInstance()->removeHook(&_voxels); | |
| 267 | − NodeList::getInstance()->removeHook(this); | |
| 268 | 268 | NodeList::getInstance()->removeDomainListener(this); |
| 269 | 269 | |
| 270 | 270 | _sharedVoxelSystem.changeTree(new VoxelTree); |
| @@ -274,7 +274,6 @@ Application::~Application() { · 3 unmodified lines | ||
| 274 | 274 | |
| 275 | 275 | delete _logger; |
| 276 | 276 | delete _settings; |
| 277 | − delete _followMode; | |
| 278 | 277 | delete _glWidget; |
| 279 | 278 | } |
| 280 | 279 | |
| @@ -330,12 +329,6 @@ void Application::initializeGL() { · 49 unmodified lines | ||
| 330 | 329 | init(); |
| 331 | 330 | qDebug( "init() complete."); |
| 332 | 331 | |
| 333 | − // create thread for receipt of data via UDP | |
| 334 | − if (_enableNetworkThread) { | |
| 335 | − pthread_create(&_networkReceiveThread, NULL, networkReceive, NULL); | |
| 336 | − qDebug("Network receive thread created."); | |
| 337 | − } | |
| 338 | − | |
| 339 | 332 | // create thread for parsing of voxel data independent of the main network and rendering threads |
| 340 | 333 | _voxelProcessor.initialize(_enableProcessVoxelsThread); |
| 341 | 334 | _voxelEditSender.initialize(_enableProcessVoxelsThread); |
| @@ -1416,11 +1409,6 @@ void Application::terminate() { · 1074 unmodified lines | ||
| 1416 | 1409 | // let the avatar mixer know we're out |
| 1417 | 1410 | NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1); |
| 1418 | 1411 | |
| 1419 | − if (_enableNetworkThread) { | |
| 1420 | − _stopNetworkReceiveThread = true; | |
| 1421 | − pthread_join(_networkReceiveThread, NULL); | |
| 1422 | − } | |
| 1423 | − | |
| 1424 | 1412 | printf(""); |
| 1425 | 1413 | _voxelProcessor.terminate(); |
| 1426 | 1414 | _voxelHideShowThread.terminate(); |
| @@ -1433,7 +1421,7 @@ void Application::terminate() { · 6 unmodified lines | ||
| 1433 | 1421 | static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) { |
| 1434 | 1422 | // record the packet for stats-tracking |
| 1435 | 1423 | Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AVATARS).updateValue(dataBytes); |
| 1436 | − Node* avatarMixerNode = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 1424 | + SharedNodePointer avatarMixerNode = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 1437 | 1425 | if (avatarMixerNode) { |
| 1438 | 1426 | avatarMixerNode->recordBytesReceived(dataBytes); |
| 1439 | 1427 | } |
| @@ -1450,7 +1438,7 @@ static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& da · 10 unmodified lines | ||
| 1450 | 1438 | dataBytes -= NUM_BYTES_RFC4122_UUID; |
| 1451 | 1439 | |
| 1452 | 1440 | // make sure the node exists |
| 1453 | − Node* node = NodeList::getInstance()->nodeWithUUID(nodeUUID); | |
| 1441 | + SharedNodePointer node = NodeList::getInstance()->nodeWithUUID(nodeUUID); | |
| 1454 | 1442 | if (!node || !node->getLinkedData()) { |
| 1455 | 1443 | return NULL; |
| 1456 | 1444 | } |
| @@ -1915,10 +1903,6 @@ void Application::init() { · 458 unmodified lines | ||
| 1915 | 1903 | _glWidget->width(), |
| 1916 | 1904 | _glWidget->height()); |
| 1917 | 1905 | |
| 1918 | − _followMode = new QAction(this); | |
| 1919 | − connect(_followMode, SIGNAL(triggered()), this, SLOT(toggleFollowMode())); | |
| 1920 | − _pieMenu.addAction(_followMode); | |
| 1921 | − | |
| 1922 | 1906 | _audio.init(_glWidget); |
| 1923 | 1907 | |
| 1924 | 1908 | _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); |
| @@ -1976,16 +1960,16 @@ void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, cons · 51 unmodified lines | ||
| 1976 | 1960 | Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection, |
| 1977 | 1961 | glm::vec3& eyePosition, QUuid& nodeUUID = DEFAULT_NODE_ID_REF) { |
| 1978 | 1962 | |
| 1979 | − NodeList* nodeList = NodeList::getInstance(); | |
| 1980 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 1963 | + foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | |
| 1981 | 1964 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 1982 | 1965 | Avatar* avatar = (Avatar*)node->getLinkedData(); |
| 1983 | 1966 | float distance; |
| 1967 | + | |
| 1984 | 1968 | if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) { |
| 1985 | 1969 | // rescale to compensate for head embiggening |
| 1986 | 1970 | eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) * |
| 1987 | − (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); | |
| 1988 | − | |
| 1971 | + (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); | |
| 1972 | + | |
| 1989 | 1973 | _lookatIndicatorScale = avatar->getHead().getScale(); |
| 1990 | 1974 | _lookatOtherPosition = avatar->getHead().getPosition(); |
| 1991 | 1975 | nodeUUID = avatar->getOwningNode()->getUUID(); |
| @@ -1993,6 +1977,7 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 1 unmodified line | ||
| 1993 | 1977 | } |
| 1994 | 1978 | } |
| 1995 | 1979 | } |
| 1980 | + | |
| 1996 | 1981 | return NULL; |
| 1997 | 1982 | } |
| 1998 | 1983 | |
| @@ -2017,71 +2002,6 @@ void Application::renderLookatIndicator(glm::vec3 pointOfInterest) { · 18 unmodified lines | ||
| 2017 | 2002 | renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS); |
| 2018 | 2003 | } |
| 2019 | 2004 | |
| 2020 | −void maybeBeginFollowIndicator(bool& began) { | |
| 2021 | − if (!began) { | |
| 2022 | − Application::getInstance()->getGlowEffect()->begin(); | |
| 2023 | − glLineWidth(5); | |
| 2024 | − glBegin(GL_LINES); | |
| 2025 | − began = true; | |
| 2026 | − } | |
| 2027 | −} | |
| 2028 | − | |
| 2029 | −void Application::renderFollowIndicator() { | |
| 2030 | − NodeList* nodeList = NodeList::getInstance(); | |
| 2031 | − | |
| 2032 | − // initialize lazily so that we don't enable the glow effect unnecessarily | |
| 2033 | − bool began = false; | |
| 2034 | − | |
| 2035 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); ++node) { | |
| 2036 | − if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { | |
| 2037 | − Avatar* avatar = (Avatar *) node->getLinkedData(); | |
| 2038 | − Avatar* leader = NULL; | |
| 2039 | − | |
| 2040 | − if (!avatar->getLeaderUUID().isNull()) { | |
| 2041 | − if (avatar->getLeaderUUID() == NodeList::getInstance()->getOwnerUUID()) { | |
| 2042 | − leader = &_myAvatar; | |
| 2043 | − } else { | |
| 2044 | − for (NodeList::iterator it = nodeList->begin(); it != nodeList->end(); ++it) { | |
| 2045 | − if(it->getUUID() == avatar->getLeaderUUID() | |
| 2046 | − && it->getType() == NODE_TYPE_AGENT) { | |
| 2047 | − leader = (Avatar*) it->getLinkedData(); | |
| 2048 | − } | |
| 2049 | − } | |
| 2050 | − } | |
| 2051 | − | |
| 2052 | − if (leader != NULL) { | |
| 2053 | − maybeBeginFollowIndicator(began); | |
| 2054 | − glColor3f(1.f, 0.f, 0.f); | |
| 2055 | − glVertex3f((avatar->getHead().getPosition().x + avatar->getPosition().x) / 2.f, | |
| 2056 | − (avatar->getHead().getPosition().y + avatar->getPosition().y) / 2.f, | |
| 2057 | − (avatar->getHead().getPosition().z + avatar->getPosition().z) / 2.f); | |
| 2058 | − glColor3f(0.f, 1.f, 0.f); | |
| 2059 | − glVertex3f((leader->getHead().getPosition().x + leader->getPosition().x) / 2.f, | |
| 2060 | − (leader->getHead().getPosition().y + leader->getPosition().y) / 2.f, | |
| 2061 | − (leader->getHead().getPosition().z + leader->getPosition().z) / 2.f); | |
| 2062 | − } | |
| 2063 | − } | |
| 2064 | − } | |
| 2065 | − } | |
| 2066 | − | |
| 2067 | − if (_myAvatar.getLeadingAvatar() != NULL) { | |
| 2068 | − maybeBeginFollowIndicator(began); | |
| 2069 | − glColor3f(1.f, 0.f, 0.f); | |
| 2070 | − glVertex3f((_myAvatar.getHead().getPosition().x + _myAvatar.getPosition().x) / 2.f, | |
| 2071 | − (_myAvatar.getHead().getPosition().y + _myAvatar.getPosition().y) / 2.f, | |
| 2072 | − (_myAvatar.getHead().getPosition().z + _myAvatar.getPosition().z) / 2.f); | |
| 2073 | − glColor3f(0.f, 1.f, 0.f); | |
| 2074 | − glVertex3f((_myAvatar.getLeadingAvatar()->getHead().getPosition().x + _myAvatar.getLeadingAvatar()->getPosition().x) / 2.f, | |
| 2075 | − (_myAvatar.getLeadingAvatar()->getHead().getPosition().y + _myAvatar.getLeadingAvatar()->getPosition().y) / 2.f, | |
| 2076 | − (_myAvatar.getLeadingAvatar()->getHead().getPosition().z + _myAvatar.getLeadingAvatar()->getPosition().z) / 2.f); | |
| 2077 | − } | |
| 2078 | − | |
| 2079 | − if (began) { | |
| 2080 | − glEnd(); | |
| 2081 | − _glowEffect.end(); | |
| 2082 | − } | |
| 2083 | −} | |
| 2084 | − | |
| 2085 | 2005 | void Application::renderHighlightVoxel(VoxelDetail voxel) { |
| 2086 | 2006 | glDisable(GL_LIGHTING); |
| 2087 | 2007 | glPushMatrix(); |
| @@ -2099,10 +2019,9 @@ void Application::renderHighlightVoxel(VoxelDetail voxel) { · 11 unmodified lines | ||
| 2099 | 2019 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { |
| 2100 | 2020 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2101 | 2021 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); |
| 2102 | − NodeList* nodeList = NodeList::getInstance(); | |
| 2103 | − | |
| 2104 | − for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 2105 | − node->lock(); | |
| 2022 | + | |
| 2023 | + foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | |
| 2024 | + QMutexLocker(&node->getMutex()); | |
| 2106 | 2025 | if (node->getLinkedData()) { |
| 2107 | 2026 | Avatar *avatar = (Avatar *)node->getLinkedData(); |
| 2108 | 2027 | if (!avatar->isInitialized()) { |
| @@ -2111,7 +2030,6 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 2 unmodified lines | ||
| 2111 | 2030 | avatar->simulate(deltaTime, NULL); |
| 2112 | 2031 | avatar->setMouseRay(mouseRayOrigin, mouseRayDirection); |
| 2113 | 2032 | } |
| 2114 | − node->unlock(); | |
| 2115 | 2033 | } |
| 2116 | 2034 | |
| 2117 | 2035 | // simulate avatar fades |
| @@ -2377,11 +2295,6 @@ void Application::updateThreads(float deltaTime) { · 259 unmodified lines | ||
| 2377 | 2295 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2378 | 2296 | PerformanceWarning warn(showWarnings, "Application::updateThreads()"); |
| 2379 | 2297 | |
| 2380 | − // read incoming packets from network | |
| 2381 | − if (!_enableNetworkThread) { | |
| 2382 | − networkReceive(0); | |
| 2383 | − } | |
| 2384 | − | |
| 2385 | 2298 | // parse voxel packets |
| 2386 | 2299 | if (!_enableProcessVoxelsThread) { |
| 2387 | 2300 | _voxelProcessor.threadRoutine(); |
| @@ -2694,39 +2607,36 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 306 unmodified lines | ||
| 2694 | 2607 | |
| 2695 | 2608 | unsigned char voxelQueryPacket[MAX_PACKET_SIZE]; |
| 2696 | 2609 | |
| 2697 | − NodeList* nodeList = NodeList::getInstance(); | |
| 2698 | − | |
| 2699 | 2610 | // Iterate all of the nodes, and get a count of how many voxel servers we have... |
| 2700 | 2611 | int totalServers = 0; |
| 2701 | 2612 | int inViewServers = 0; |
| 2702 | 2613 | int unknownJurisdictionServers = 0; |
| 2703 | − | |
| 2704 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 2705 | − | |
| 2614 | + | |
| 2615 | + foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | |
| 2706 | 2616 | // only send to the NodeTypes that are serverType |
| 2707 | 2617 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2708 | 2618 | totalServers++; |
| 2709 | − | |
| 2619 | + | |
| 2710 | 2620 | // get the server bounds for this server |
| 2711 | 2621 | QUuid nodeUUID = node->getUUID(); |
| 2712 | − | |
| 2622 | + | |
| 2713 | 2623 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2714 | 2624 | // can get the jurisdiction... |
| 2715 | 2625 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| 2716 | 2626 | unknownJurisdictionServers++; |
| 2717 | 2627 | } else { |
| 2718 | 2628 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2719 | − | |
| 2629 | + | |
| 2720 | 2630 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2721 | − | |
| 2631 | + | |
| 2722 | 2632 | if (rootCode) { |
| 2723 | 2633 | VoxelPositionSize rootDetails; |
| 2724 | 2634 | voxelDetailsForCode(rootCode, rootDetails); |
| 2725 | 2635 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2726 | 2636 | serverBounds.scale(TREE_SCALE); |
| 2727 | − | |
| 2637 | + | |
| 2728 | 2638 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2729 | − | |
| 2639 | + | |
| 2730 | 2640 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2731 | 2641 | inViewServers++; |
| 2732 | 2642 | } |
| @@ -2759,18 +2669,20 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 26 unmodified lines | ||
| 2759 | 2669 | if (wantExtraDebugging && unknownJurisdictionServers > 0) { |
| 2760 | 2670 | qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); |
| 2761 | 2671 | } |
| 2762 | − | |
| 2763 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 2672 | + | |
| 2673 | + NodeList* nodeList = NodeList::getInstance(); | |
| 2674 | + | |
| 2675 | + foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | |
| 2764 | 2676 | // only send to the NodeTypes that are serverType |
| 2765 | 2677 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2766 | − | |
| 2767 | − | |
| 2678 | + | |
| 2679 | + | |
| 2768 | 2680 | // get the server bounds for this server |
| 2769 | 2681 | QUuid nodeUUID = node->getUUID(); |
| 2770 | − | |
| 2682 | + | |
| 2771 | 2683 | bool inView = false; |
| 2772 | 2684 | bool unknownView = false; |
| 2773 | − | |
| 2685 | + | |
| 2774 | 2686 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2775 | 2687 | // can get the jurisdiction... |
| 2776 | 2688 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| @@ -2780,15 +2692,15 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 3 unmodified lines | ||
| 2780 | 2692 | } |
| 2781 | 2693 | } else { |
| 2782 | 2694 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2783 | − | |
| 2695 | + | |
| 2784 | 2696 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2785 | − | |
| 2697 | + | |
| 2786 | 2698 | if (rootCode) { |
| 2787 | 2699 | VoxelPositionSize rootDetails; |
| 2788 | 2700 | voxelDetailsForCode(rootCode, rootDetails); |
| 2789 | 2701 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2790 | 2702 | serverBounds.scale(TREE_SCALE); |
| 2791 | − | |
| 2703 | + | |
| 2792 | 2704 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2793 | 2705 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2794 | 2706 | inView = true; |
| @@ -2801,7 +2713,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 6 unmodified lines | ||
| 2801 | 2713 | } |
| 2802 | 2714 | } |
| 2803 | 2715 | } |
| 2804 | − | |
| 2716 | + | |
| 2805 | 2717 | if (inView) { |
| 2806 | 2718 | _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); |
| 2807 | 2719 | } else if (unknownView) { |
| @@ -2809,7 +2721,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1 unmodified line | ||
| 2809 | 2721 | qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " |
| 2810 | 2722 | << perUnknownServer << " to send us jurisdiction."; |
| 2811 | 2723 | } |
| 2812 | − | |
| 2724 | + | |
| 2813 | 2725 | // set the query's position/orientation to be degenerate in a manner that will get the scene quickly |
| 2814 | 2726 | // If there's only one server, then don't do this, and just let the normal voxel query pass through |
| 2815 | 2727 | // as expected... this way, we will actually get a valid scene if there is one to be seen |
| @@ -2833,24 +2745,24 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 17 unmodified lines | ||
| 2833 | 2745 | } |
| 2834 | 2746 | // set up the packet for sending... |
| 2835 | 2747 | unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; |
| 2836 | − | |
| 2748 | + | |
| 2837 | 2749 | // insert packet type/version and node UUID |
| 2838 | 2750 | endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, packetType); |
| 2839 | 2751 | QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); |
| 2840 | 2752 | memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); |
| 2841 | 2753 | endOfVoxelQueryPacket += ownerUUID.size(); |
| 2842 | − | |
| 2754 | + | |
| 2843 | 2755 | // encode the query data... |
| 2844 | 2756 | endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); |
| 2845 | − | |
| 2757 | + | |
| 2846 | 2758 | int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; |
| 2847 | − | |
| 2759 | + | |
| 2848 | 2760 | // make sure we still have an active socket |
| 2849 | 2761 | if (node->getActiveSocket()) { |
| 2850 | 2762 | nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength, |
| 2851 | − node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort()); | |
| 2763 | + node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort()); | |
| 2852 | 2764 | } |
| 2853 | − | |
| 2765 | + | |
| 2854 | 2766 | // Feed number of bytes to corresponding channel of the bandwidth meter |
| 2855 | 2767 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); |
| 2856 | 2768 | } |
| @@ -3207,12 +3119,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 350 unmodified lines | ||
| 3207 | 3119 | } |
| 3208 | 3120 | } |
| 3209 | 3121 | |
| 3210 | − { | |
| 3211 | − PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3212 | − "Application::displaySide() ... renderFollowIndicator..."); | |
| 3213 | − renderFollowIndicator(); | |
| 3214 | − } | |
| 3215 | − | |
| 3216 | 3122 | // render transmitter pick ray, if non-empty |
| 3217 | 3123 | if (_transmitterPickStart != _transmitterPickEnd) { |
| 3218 | 3124 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| @@ -3335,12 +3241,12 @@ void Application::displayOverlay() { · 116 unmodified lines | ||
| 3335 | 3241 | glPointSize(1.0f); |
| 3336 | 3242 | char nodes[100]; |
| 3337 | 3243 | |
| 3338 | − NodeList* nodeList = NodeList::getInstance(); | |
| 3339 | 3244 | int totalAvatars = 0, totalServers = 0; |
| 3340 | − | |
| 3341 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 3245 | + | |
| 3246 | + foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | |
| 3342 | 3247 | node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++; |
| 3343 | 3248 | } |
| 3249 | + | |
| 3344 | 3250 | sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars); |
| 3345 | 3251 | drawtext(_glWidget->width() - 150, 20, 0.10, 0, 1.0, 0, nodes, 1, 0, 0); |
| 3346 | 3252 | } |
| @@ -3440,8 +3346,8 @@ void Application::displayStats() { · 93 unmodified lines | ||
| 3440 | 3346 | int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0; |
| 3441 | 3347 | |
| 3442 | 3348 | NodeList* nodeList = NodeList::getInstance(); |
| 3443 | − Node* audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER); | |
| 3444 | − Node* avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 3349 | + SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER); | |
| 3350 | + SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 3445 | 3351 | |
| 3446 | 3352 | pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0; |
| 3447 | 3353 | pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0; |
| @@ -3450,7 +3356,8 @@ void Application::displayStats() { · 2 unmodified lines | ||
| 3450 | 3356 | // Now handle voxel servers, since there could be more than one, we average their ping times |
| 3451 | 3357 | unsigned long totalPingVoxel = 0; |
| 3452 | 3358 | int voxelServerCount = 0; |
| 3453 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 3359 | + | |
| 3360 | + foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | |
| 3454 | 3361 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 3455 | 3362 | totalPingVoxel += node->getPingMs(); |
| 3456 | 3363 | voxelServerCount++; |
| @@ -3459,6 +3366,7 @@ void Application::displayStats() { · 2 unmodified lines | ||
| 3459 | 3366 | } |
| 3460 | 3367 | } |
| 3461 | 3368 | } |
| 3369 | + | |
| 3462 | 3370 | if (voxelServerCount) { |
| 3463 | 3371 | pingVoxel = totalPingVoxel/voxelServerCount; |
| 3464 | 3372 | } |
| @@ -3475,7 +3383,7 @@ void Application::displayStats() { · 10 unmodified lines | ||
| 3475 | 3383 | sprintf(avatarStats, "Avatar: pos %.3f, %.3f, %.3f, vel %.1f, yaw = %.2f", avatarPos.x, avatarPos.y, avatarPos.z, glm::length(_myAvatar.getVelocity()), _myAvatar.getBodyYaw()); |
| 3476 | 3384 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, avatarStats); |
| 3477 | 3385 | |
| 3478 | − Node* avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 3386 | + SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 3479 | 3387 | char avatarMixerStats[200]; |
| 3480 | 3388 | if (avatarMixer) { |
| 3481 | 3389 | sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps", |
| @@ -3794,10 +3702,10 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 312 unmodified lines | ||
| 3794 | 3702 | if (!selfAvatarOnly) { |
| 3795 | 3703 | // Render avatars of other nodes |
| 3796 | 3704 | NodeList* nodeList = NodeList::getInstance(); |
| 3797 | − | |
| 3798 | − for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 3799 | − node->lock(); | |
| 3800 | − | |
| 3705 | + | |
| 3706 | + foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | |
| 3707 | + QMutexLocker(&node->getMutex()); | |
| 3708 | + | |
| 3801 | 3709 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 3802 | 3710 | Avatar *avatar = (Avatar *)node->getLinkedData(); |
| 3803 | 3711 | if (!avatar->isInitialized()) { |
| @@ -3806,8 +3714,6 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 2 unmodified lines | ||
| 3806 | 3714 | avatar->render(false); |
| 3807 | 3715 | avatar->setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors)); |
| 3808 | 3716 | } |
| 3809 | − | |
| 3810 | − node->unlock(); | |
| 3811 | 3717 | } |
| 3812 | 3718 | |
| 3813 | 3719 | // render avatar fades |
| @@ -4052,18 +3958,6 @@ void Application::eyedropperVoxelUnderCursor() { · 238 unmodified lines | ||
| 4052 | 3958 | } |
| 4053 | 3959 | } |
| 4054 | 3960 | |
| 4055 | −void Application::toggleFollowMode() { | |
| 4056 | − glm::vec3 mouseRayOrigin, mouseRayDirection; | |
| 4057 | − _viewFrustum.computePickRay(_pieMenu.getX() / (float)_glWidget->width(), | |
| 4058 | − _pieMenu.getY() / (float)_glWidget->height(), | |
| 4059 | − mouseRayOrigin, mouseRayDirection); | |
| 4060 | − glm::vec3 eyePositionIgnored; | |
| 4061 | − QUuid nodeUUIDIgnored; | |
| 4062 | − Avatar* leadingAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeUUIDIgnored); | |
| 4063 | − | |
| 4064 | − _myAvatar.follow(leadingAvatar); | |
| 4065 | −} | |
| 4066 | − | |
| 4067 | 3961 | void Application::resetSensors() { |
| 4068 | 3962 | _headMouseX = _mouseX = _glWidget->width() / 2; |
| 4069 | 3963 | _headMouseY = _mouseY = _glWidget->height() / 2; |
| @@ -4143,11 +4037,7 @@ void Application::domainChanged(QString domain) { · 73 unmodified lines | ||
| 4143 | 4037 | updateLocalOctreeCache(); |
| 4144 | 4038 | } |
| 4145 | 4039 | |
| 4146 | −void Application::nodeAdded(Node* node) { | |
| 4147 | − | |
| 4148 | −} | |
| 4149 | − | |
| 4150 | −void Application::nodeKilled(Node* node) { | |
| 4040 | +void Application::nodeKilled(SharedNodePointer node) { | |
| 4151 | 4041 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 4152 | 4042 | QUuid nodeUUID = node->getUUID(); |
| 4153 | 4043 | // see if this is the first we've heard of this node... |
| @@ -4227,7 +4117,7 @@ void Application::trackIncomingVoxelPacket(unsigned char* messageData, ssize_t m · 73 unmodified lines | ||
| 4227 | 4117 | const HifiSockAddr& senderSockAddr, bool wasStatsPacket) { |
| 4228 | 4118 | |
| 4229 | 4119 | // Attempt to identify the sender from it's address. |
| 4230 | − Node* serverNode = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4120 | + SharedNodePointer serverNode = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4231 | 4121 | if (serverNode) { |
| 4232 | 4122 | QUuid nodeUUID = serverNode->getUUID(); |
| 4233 | 4123 | |
| @@ -4244,7 +4134,7 @@ void Application::trackIncomingVoxelPacket(unsigned char* messageData, ssize_t m · 10 unmodified lines | ||
| 4244 | 4134 | int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLength, const HifiSockAddr& senderSockAddr) { |
| 4245 | 4135 | |
| 4246 | 4136 | // But, also identify the sender, and keep track of the contained jurisdiction root for this server |
| 4247 | − Node* server = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4137 | + SharedNodePointer server = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4248 | 4138 | |
| 4249 | 4139 | // parse the incoming stats datas stick it in a temporary object for now, while we |
| 4250 | 4140 | // determine which server it belongs to |
| @@ -4301,105 +4191,95 @@ int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLen · 50 unmodified lines | ||
| 4301 | 4191 | } |
| 4302 | 4192 | |
| 4303 | 4193 | // Receive packets from other nodes/servers and decide what to do with them! |
| 4304 | −void* Application::networkReceive(void* args) { | |
| 4194 | +void Application::processDatagrams() { | |
| 4305 | 4195 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 4306 | 4196 | "Application::networkReceive()"); |
| 4307 | 4197 | |
| 4308 | 4198 | HifiSockAddr senderSockAddr; |
| 4309 | 4199 | ssize_t bytesReceived; |
| 4310 | 4200 | |
| 4311 | − Application* app = Application::getInstance(); | |
| 4312 | − while (!app->_stopNetworkReceiveThread) { | |
| 4313 | − if (NodeList::getInstance()->getNodeSocket().hasPendingDatagrams() && | |
| 4314 | − (bytesReceived = NodeList::getInstance()->getNodeSocket().readDatagram((char*) app->_incomingPacket, | |
| 4315 | − MAX_PACKET_SIZE, | |
| 4316 | − senderSockAddr.getAddressPointer(), | |
| 4317 | − senderSockAddr.getPortPointer()))) { | |
| 4318 | − | |
| 4319 | − app->_packetCount++; | |
| 4320 | − app->_bytesCount += bytesReceived; | |
| 4321 | − | |
| 4322 | − if (packetVersionMatch(app->_incomingPacket)) { | |
| 4323 | − // only process this packet if we have a match on the packet version | |
| 4324 | − switch (app->_incomingPacket[0]) { | |
| 4325 | − case PACKET_TYPE_TRANSMITTER_DATA_V2: | |
| 4326 | − // V2 = IOS transmitter app | |
| 4327 | − app->_myTransmitter.processIncomingData(app->_incomingPacket, bytesReceived); | |
| 4328 | − | |
| 4329 | − break; | |
| 4330 | − case PACKET_TYPE_MIXED_AUDIO: | |
| 4331 | − QMetaObject::invokeMethod(&app->_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, | |
| 4332 | − Q_ARG(QByteArray, QByteArray((char*) app->_incomingPacket, bytesReceived))); | |
| 4333 | − break; | |
| 4334 | − | |
| 4335 | − case PACKET_TYPE_PARTICLE_ADD_RESPONSE: | |
| 4336 | − // look up our ParticleEditHanders.... | |
| 4337 | − ParticleEditHandle::handleAddResponse(app->_incomingPacket, bytesReceived); | |
| 4338 | − break; | |
| 4339 | − | |
| 4340 | − case PACKET_TYPE_PARTICLE_DATA: | |
| 4341 | − case PACKET_TYPE_VOXEL_DATA: | |
| 4342 | − case PACKET_TYPE_VOXEL_ERASE: | |
| 4343 | − case PACKET_TYPE_OCTREE_STATS: | |
| 4344 | − case PACKET_TYPE_ENVIRONMENT_DATA: { | |
| 4345 | − PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 4346 | − "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); | |
| 4347 | − | |
| 4348 | − bool wantExtraDebugging = app->getLogger()->extraDebugging(); | |
| 4349 | − if (wantExtraDebugging && app->_incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { | |
| 4350 | − int numBytesPacketHeader = numBytesForPacketHeader(app->_incomingPacket); | |
| 4351 | − unsigned char* dataAt = app->_incomingPacket + numBytesPacketHeader; | |
| 4352 | − dataAt += sizeof(VOXEL_PACKET_FLAGS); | |
| 4353 | − VOXEL_PACKET_SEQUENCE sequence = (*(VOXEL_PACKET_SEQUENCE*)dataAt); | |
| 4354 | − dataAt += sizeof(VOXEL_PACKET_SEQUENCE); | |
| 4355 | − VOXEL_PACKET_SENT_TIME sentAt = (*(VOXEL_PACKET_SENT_TIME*)dataAt); | |
| 4356 | − dataAt += sizeof(VOXEL_PACKET_SENT_TIME); | |
| 4357 | − VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); | |
| 4358 | − int flightTime = arrivedAt - sentAt; | |
| 4359 | − | |
| 4360 | − printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); | |
| 4361 | − } | |
| 4362 | − | |
| 4363 | − // add this packet to our list of voxel packets and process them on the voxel processing | |
| 4364 | − app->_voxelProcessor.queueReceivedPacket(senderSockAddr, app->_incomingPacket, bytesReceived); | |
| 4365 | − break; | |
| 4201 | + while (NodeList::getInstance()->getNodeSocket().hasPendingDatagrams() && | |
| 4202 | + (bytesReceived = NodeList::getInstance()->getNodeSocket().readDatagram((char*) _incomingPacket, | |
| 4203 | + MAX_PACKET_SIZE, | |
| 4204 | + senderSockAddr.getAddressPointer(), | |
| 4205 | + senderSockAddr.getPortPointer()))) { | |
| 4206 | + | |
| 4207 | + _packetCount++; | |
| 4208 | + _bytesCount += bytesReceived; | |
| 4209 | + | |
| 4210 | + if (packetVersionMatch(_incomingPacket)) { | |
| 4211 | + // only process this packet if we have a match on the packet version | |
| 4212 | + switch (_incomingPacket[0]) { | |
| 4213 | + case PACKET_TYPE_TRANSMITTER_DATA_V2: | |
| 4214 | + // V2 = IOS transmitter app | |
| 4215 | + _myTransmitter.processIncomingData(_incomingPacket, bytesReceived); | |
| 4216 | + | |
| 4217 | + break; | |
| 4218 | + case PACKET_TYPE_MIXED_AUDIO: | |
| 4219 | + QMetaObject::invokeMethod(&_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, | |
| 4220 | + Q_ARG(QByteArray, QByteArray((char*) _incomingPacket, bytesReceived))); | |
| 4221 | + break; | |
| 4222 | + | |
| 4223 | + case PACKET_TYPE_PARTICLE_ADD_RESPONSE: | |
| 4224 | + // look up our ParticleEditHanders.... | |
| 4225 | + ParticleEditHandle::handleAddResponse(_incomingPacket, bytesReceived); | |
| 4226 | + break; | |
| 4227 | + | |
| 4228 | + case PACKET_TYPE_PARTICLE_DATA: | |
| 4229 | + case PACKET_TYPE_VOXEL_DATA: | |
| 4230 | + case PACKET_TYPE_VOXEL_ERASE: | |
| 4231 | + case PACKET_TYPE_OCTREE_STATS: | |
| 4232 | + case PACKET_TYPE_ENVIRONMENT_DATA: { | |
| 4233 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 4234 | + "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); | |
| 4235 | + | |
| 4236 | + bool wantExtraDebugging = getLogger()->extraDebugging(); | |
| 4237 | + if (wantExtraDebugging && _incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { | |
| 4238 | + int numBytesPacketHeader = numBytesForPacketHeader(_incomingPacket); | |
| 4239 | + unsigned char* dataAt = _incomingPacket + numBytesPacketHeader; | |
| 4240 | + dataAt += sizeof(VOXEL_PACKET_FLAGS); | |
| 4241 | + VOXEL_PACKET_SEQUENCE sequence = (*(VOXEL_PACKET_SEQUENCE*)dataAt); | |
| 4242 | + dataAt += sizeof(VOXEL_PACKET_SEQUENCE); | |
| 4243 | + VOXEL_PACKET_SENT_TIME sentAt = (*(VOXEL_PACKET_SENT_TIME*)dataAt); | |
| 4244 | + dataAt += sizeof(VOXEL_PACKET_SENT_TIME); | |
| 4245 | + VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); | |
| 4246 | + int flightTime = arrivedAt - sentAt; | |
| 4247 | + | |
| 4248 | + printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); | |
| 4366 | 4249 | } |
| 4367 | − case PACKET_TYPE_METAVOXEL_DATA: | |
| 4368 | − app->_metavoxels.processData(QByteArray((const char*)app->_incomingPacket, bytesReceived), | |
| 4369 | − senderSockAddr); | |
| 4370 | − break; | |
| 4371 | − case PACKET_TYPE_BULK_AVATAR_DATA: | |
| 4372 | − NodeList::getInstance()->processBulkNodeData(senderSockAddr, | |
| 4373 | − app->_incomingPacket, | |
| 4374 | − bytesReceived); | |
| 4375 | − getInstance()->_bandwidthMeter.inputStream(BandwidthMeter::AVATARS).updateValue(bytesReceived); | |
| 4376 | − break; | |
| 4377 | − case PACKET_TYPE_AVATAR_URLS: | |
| 4378 | − processAvatarURLsMessage(app->_incomingPacket, bytesReceived); | |
| 4379 | − break; | |
| 4380 | − case PACKET_TYPE_AVATAR_FACE_VIDEO: | |
| 4381 | − processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived); | |
| 4382 | − break; | |
| 4383 | − case PACKET_TYPE_DATA_SERVER_GET: | |
| 4384 | − case PACKET_TYPE_DATA_SERVER_PUT: | |
| 4385 | − case PACKET_TYPE_DATA_SERVER_SEND: | |
| 4386 | − case PACKET_TYPE_DATA_SERVER_CONFIRM: | |
| 4387 | − DataServerClient::processMessageFromDataServer(app->_incomingPacket, bytesReceived); | |
| 4388 | − break; | |
| 4389 | − default: | |
| 4390 | − NodeList::getInstance()->processNodeData(senderSockAddr, app->_incomingPacket, bytesReceived); | |
| 4391 | − break; | |
| 4250 | + | |
| 4251 | + // add this packet to our list of voxel packets and process them on the voxel processing | |
| 4252 | + _voxelProcessor.queueReceivedPacket(senderSockAddr, _incomingPacket, bytesReceived); | |
| 4253 | + break; | |
| 4392 | 4254 | } |
| 4255 | + case PACKET_TYPE_METAVOXEL_DATA: | |
| 4256 | + _metavoxels.processData(QByteArray((const char*) _incomingPacket, bytesReceived), | |
| 4257 | + senderSockAddr); | |
| 4258 | + break; | |
| 4259 | + case PACKET_TYPE_BULK_AVATAR_DATA: | |
| 4260 | + NodeList::getInstance()->processBulkNodeData(senderSockAddr, | |
| 4261 | + _incomingPacket, | |
| 4262 | + bytesReceived); | |
| 4263 | + getInstance()->_bandwidthMeter.inputStream(BandwidthMeter::AVATARS).updateValue(bytesReceived); | |
| 4264 | + break; | |
| 4265 | + case PACKET_TYPE_AVATAR_URLS: | |
| 4266 | + processAvatarURLsMessage(_incomingPacket, bytesReceived); | |
| 4267 | + break; | |
| 4268 | + case PACKET_TYPE_AVATAR_FACE_VIDEO: | |
| 4269 | + processAvatarFaceVideoMessage(_incomingPacket, bytesReceived); | |
| 4270 | + break; | |
| 4271 | + case PACKET_TYPE_DATA_SERVER_GET: | |
| 4272 | + case PACKET_TYPE_DATA_SERVER_PUT: | |
| 4273 | + case PACKET_TYPE_DATA_SERVER_SEND: | |
| 4274 | + case PACKET_TYPE_DATA_SERVER_CONFIRM: | |
| 4275 | + DataServerClient::processMessageFromDataServer(_incomingPacket, bytesReceived); | |
| 4276 | + break; | |
| 4277 | + default: | |
| 4278 | + NodeList::getInstance()->processNodeData(senderSockAddr, _incomingPacket, bytesReceived); | |
| 4279 | + break; | |
| 4393 | 4280 | } |
| 4394 | − } else if (!app->_enableNetworkThread) { | |
| 4395 | − break; | |
| 4396 | 4281 | } |
| 4397 | 4282 | } |
| 4398 | − | |
| 4399 | − if (app->_enableNetworkThread) { | |
| 4400 | − pthread_exit(0); | |
| 4401 | − } | |
| 4402 | − return NULL; | |
| 4403 | 4283 | } |
| 4404 | 4284 | |
| 4405 | 4285 | void Application::packetSentNotification(ssize_t length) { |