History

clear domain octree details if ES killed

Stephen Birarda committed 9 years ago

Commit 038ac741 parent a21a34a2 files · +9 −30Browse files

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

Unified · Split

interface/src/Application.cpp+8−30
@@ -797,7 +797,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 796 unmodified lines
797 connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));797 connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
798 connect(&domainHandler, SIGNAL(connectedToDomain(const QString&)), SLOT(updateWindowTitle()));798 connect(&domainHandler, SIGNAL(connectedToDomain(const QString&)), SLOT(updateWindowTitle()));
799 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));799 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
800 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));800 connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &Application::clearDomainAvatars);
801 connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, [this]() {801 connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, [this]() {
802 getOverlays().deleteOverlay(getTabletScreenID());802 getOverlays().deleteOverlay(getTabletScreenID());
803 getOverlays().deleteOverlay(getTabletHomeButtonID());803 getOverlays().deleteOverlay(getTabletHomeButtonID());
@@ -5196,14 +5196,17 @@ void Application::clearDomainOctreeDetails() { · 4392 unmodified lines
5196 skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);5196 skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
5197 5197
5198 _recentlyClearedDomain = true;5198 _recentlyClearedDomain = true;
5199 5199
5200 DependencyManager::get<AvatarManager>()->clearOtherAvatars();
5201 DependencyManager::get<AnimationCache>()->clearUnusedResources();5200 DependencyManager::get<AnimationCache>()->clearUnusedResources();
5202 DependencyManager::get<ModelCache>()->clearUnusedResources();5201 DependencyManager::get<ModelCache>()->clearUnusedResources();
5203 DependencyManager::get<SoundCache>()->clearUnusedResources();5202 DependencyManager::get<SoundCache>()->clearUnusedResources();
5204 DependencyManager::get<TextureCache>()->clearUnusedResources();5203 DependencyManager::get<TextureCache>()->clearUnusedResources();
5205}5204}
5206 5205
5206void Application::clearDomainAvatars() {
5207 DependencyManager::get<AvatarManager>()->clearOtherAvatars();
5208}
5209
5207void Application::domainChanged(const QString& domainHostname) {5210void Application::domainChanged(const QString& domainHostname) {
5208 updateWindowTitle();5211 updateWindowTitle();
5209 // disable physics until we have enough information about our new location to not cause craziness.5212 // disable physics until we have enough information about our new location to not cause craziness.
@@ -5273,33 +5276,8 @@ void Application::nodeKilled(SharedNodePointer node) { · 63 unmodified lines
5273 if (node->getType() == NodeType::AudioMixer) {5276 if (node->getType() == NodeType::AudioMixer) {
5274 QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "audioMixerKilled");5277 QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "audioMixerKilled");
5275 } else if (node->getType() == NodeType::EntityServer) {5278 } else if (node->getType() == NodeType::EntityServer) {
5276 QUuid nodeUUID = node->getUUID();5279 // we lost an entity server, clear all of the domain octree details
5277 // see if this is the first we've heard of this node...5280 clearDomainOctreeDetails();
5278 _entityServerJurisdictions.withReadLock([&] {
5279 if (_entityServerJurisdictions.find(nodeUUID) == _entityServerJurisdictions.end()) {
5280 return;
5281 }
5282
5283 auto rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();
5284 VoxelPositionSize rootDetails;
5285 voxelDetailsForCode(rootCode.get(), rootDetails);
5286
5287 qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",
5288 (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
5289
5290 });
5291
5292 // If the model server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
5293 _entityServerJurisdictions.withWriteLock([&] {
5294 _entityServerJurisdictions.erase(_entityServerJurisdictions.find(nodeUUID));
5295 });
5296
5297 // also clean up scene stats for that server
5298 _octreeServerSceneStats.withWriteLock([&] {
5299 if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
5300 _octreeServerSceneStats.erase(nodeUUID);
5301 }
5302 });
5303 } else if (node->getType() == NodeType::AvatarMixer) {5281 } else if (node->getType() == NodeType::AvatarMixer) {
5304 // our avatar mixer has gone away - clear the hash of avatars5282 // our avatar mixer has gone away - clear the hash of avatars
5305 DependencyManager::get<AvatarManager>()->clearOtherAvatars();5283 DependencyManager::get<AvatarManager>()->clearOtherAvatars();