summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rw-r--r--[-rwxr-xr-x]indra/newview/llviewerregion.cpp81
1 files changed, 65 insertions, 16 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index cd70f8f9b9..c37daa53a3 100755..100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -104,7 +104,7 @@ S32 LLViewerRegion::sLastCameraUpdated = 0;
S32 LLViewerRegion::sNewObjectCreationThrottle = -1;
LLViewerRegion::vocache_entry_map_t LLViewerRegion::sRegionCacheCleanup;
-typedef std::map<std::string, std::string> CapabilityMap;
+typedef std::unordered_map<std::string, std::string, ll::string_hash, std::equal_to<>> CapabilityMap;
static void log_capabilities(const CapabilityMap &capmap);
@@ -1768,6 +1768,11 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
if(iter == mImpl->mActiveSet.end())
{
iter = mImpl->mActiveSet.begin();
+ if (iter == mImpl->mActiveSet.end())
+ {
+ // Set became empty
+ break;
+ }
}
if((*iter)->getParentID() > 0)
{
@@ -1886,8 +1891,17 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry)
}
else
{
- LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion();
- if(old_regionp != this)
+ LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable();
+ if (!drawablep || drawablep->isDead() || drawablep->getVObj().isNull())
+ {
+ LL_WARNS() << "Entry: " << entry->getLocalID() << " has a dead or invalid drawable; resetting to inactive." << LL_ENDL;
+ mImpl->mVisibleEntries.erase(entry);
+ entry->setState(LLVOCacheEntry::INACTIVE);
+ return NULL;
+ }
+
+ LLViewerRegion* old_regionp = drawablep->getRegion();
+ if (old_regionp != this)
{
//this object exists in two regions at the same time;
//this case can be safely ignored here because
@@ -3202,7 +3216,26 @@ void LLViewerRegion::unpackRegionHandshake()
flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes.
}
msg->addU32("Flags", flags );
- msg->sendReliable(host);
+
+ // build a lambda to be used as callback on ACK or timeout
+ void (*region_handshake_reply_callback)(void**, S32) = [](void**, S32 result)
+ {
+ if(LLApp::isExiting()) return;
+ if (result != LL_ERR_NOERR)
+ {
+ LL_WARNS("Messaging") << "RegionHandshakeReply failed with err=" << result << LL_ENDL;
+ }
+ };
+
+ // This is a crucial message for establishing a connection to a region
+ // (either the main region or a visible neighbor).
+ msg->sendReliable(
+ host,
+ gSavedSettings.getS32("UseCircuitCodeMaxRetries"),
+ false,
+ (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"),
+ region_handshake_reply_callback,
+ NULL);
mRegionTimer.reset(); //reset region timer.
}
@@ -3238,6 +3271,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("FetchInventory2");
capabilityNames.append("FetchInventoryDescendents2");
capabilityNames.append("IncrementCOFVersion");
+ capabilityNames.append("CreateTaskInventoryItem");
capabilityNames.append("RequestTaskInventory");
AISAPI::getCapNames(capabilityNames);
@@ -3291,6 +3325,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("RequestTextureDownload");
capabilityNames.append("ResourceCostSelected");
capabilityNames.append("RetrieveNavMeshSrc");
+ capabilityNames.append("ScriptDefinitions");
capabilityNames.append("SearchStatRequest");
capabilityNames.append("SearchStatTracking");
capabilityNames.append("SendPostcard");
@@ -3300,6 +3335,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("SetDisplayName");
capabilityNames.append("SimConsoleAsync");
capabilityNames.append("SimulatorFeatures");
+ capabilityNames.append("SpatialVoiceModerationRequest");
capabilityNames.append("StartGroupProposal");
capabilityNames.append("TerrainNavMeshProperties");
capabilityNames.append("TextureStats");
@@ -3437,7 +3473,7 @@ void LLViewerRegion::setCapabilityDebug(const std::string& name, const std::stri
}
}
-std::string LLViewerRegion::getCapabilityDebug(const std::string& name) const
+std::string LLViewerRegion::getCapabilityDebug(std::string_view name) const
{
CapabilityMap::const_iterator iter = mImpl->mSecondCapabilitiesTracker.find(name);
if (iter == mImpl->mSecondCapabilitiesTracker.end())
@@ -3448,15 +3484,14 @@ std::string LLViewerRegion::getCapabilityDebug(const std::string& name) const
return iter->second;
}
-
-bool LLViewerRegion::isSpecialCapabilityName(const std::string &name)
+bool LLViewerRegion::isSpecialCapabilityName(std::string_view name)
{
return name == "EventQueueGet" || name == "UntrustedSimulatorMessage";
}
-std::string LLViewerRegion::getCapability(const std::string& name) const
+std::string LLViewerRegion::getCapability(std::string_view name) const
{
- if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
+ if (!capabilitiesReceived() && (name != "Seed") && (name != "ObjectMedia"))
{
LL_WARNS() << "getCapability called before caps received for " << name << LL_ENDL;
}
@@ -3464,21 +3499,20 @@ std::string LLViewerRegion::getCapability(const std::string& name) const
CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
if(iter == mImpl->mCapabilities.end())
{
- return "";
+ return {};
}
return iter->second;
}
-bool LLViewerRegion::isCapabilityAvailable(const std::string& name) const
+bool LLViewerRegion::isCapabilityAvailable(std::string_view name) const
{
- if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
+ if (!capabilitiesReceived() && (name != "Seed") && (name != "ObjectMedia"))
{
LL_WARNS() << "isCapabilityAvailable called before caps received for " << name << LL_ENDL;
}
- CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
- if(iter == mImpl->mCapabilities.end())
+ if (!mImpl->mCapabilities.contains(name))
{
return false;
}
@@ -3734,9 +3768,14 @@ bool LLViewerRegion::avatarHoverHeightEnabled() const
void log_capabilities(const CapabilityMap &capmap)
{
+ // Copy into sorted map for ordered output
+ using SortedCapabilityMap = std::map<std::string, std::string>;
+ SortedCapabilityMap sorted_capmap;
+ sorted_capmap.insert(capmap.begin(), capmap.end());
+
S32 count = 0;
- CapabilityMap::const_iterator iter;
- for (iter = capmap.begin(); iter != capmap.end(); ++iter, ++count)
+ SortedCapabilityMap::const_iterator iter;
+ for (iter = sorted_capmap.begin(); iter != sorted_capmap.end(); ++iter, ++count)
{
if (!iter->second.empty())
{
@@ -3797,6 +3836,16 @@ std::string LLViewerRegion::getSimHostName()
return std::string("...");
}
+
+bool LLViewerRegion::isRegionWebRTCEnabled()
+{
+ if (mSimulatorFeaturesReceived && mSimulatorFeatures.has("VoiceServerType"))
+ {
+ return mSimulatorFeatures["VoiceServerType"].asString() == "webrtc";
+ }
+ return false;
+}
+
void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;