summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-02-28 21:56:25 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-02-28 21:56:25 +0200
commit1e0eafd50cc03f0796fe8678d3460aac614db603 (patch)
tree6b9efda5d63749238a786667fc2ac4c9b3fabfad /indra/newview/llviewerregion.cpp
parent1f1d762693027a0f6ce7b913bcc8984767e947be (diff)
parent6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff)
Merge branch 'master' into DRTVWR-544-maint
# Conflicts: # indra/llaudio/llstreamingaudio_fmodstudio.cpp # indra/newview/llviewerregion.cpp
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rw-r--r--indra/newview/llviewerregion.cpp72
1 files changed, 43 insertions, 29 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index f0f89dd452..5050ac1257 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -238,9 +238,9 @@ public:
LLVector3 mLastCameraOrigin;
U32 mLastCameraUpdate;
- void requestBaseCapabilitiesCoro(U64 regionHandle);
- void requestBaseCapabilitiesCompleteCoro(U64 regionHandle);
- void requestSimulatorFeatureCoro(std::string url, U64 regionHandle);
+ static void requestBaseCapabilitiesCoro(U64 regionHandle);
+ static void requestBaseCapabilitiesCompleteCoro(U64 regionHandle);
+ static void requestSimulatorFeatureCoro(std::string url, U64 regionHandle);
};
void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
@@ -268,6 +268,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities for region that no longer exists!" << LL_ENDL;
return; // this error condition is not recoverable.
}
+ LLViewerRegionImpl* impl = regionp->getRegionImplNC();
LL_DEBUGS("AppInit", "Capabilities") << "requesting seed caps for handle " << regionHandle
<< " name " << regionp->getName() << LL_ENDL;
@@ -282,26 +283,34 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
// record that we just entered a new region
newRegionEntry(*regionp);
- if (mSeedCapAttempts > mSeedCapMaxAttempts)
+ // After a few attempts, continue login. But keep trying to get the caps:
+ if (impl->mSeedCapAttempts >= impl->mSeedCapMaxAttemptsBeforeLogin &&
+ STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
{
- LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mSeedCapAttempts << " attempts. Giving up!" << LL_ENDL;
- regionp->setCapabilitiesError();
+ LLStartUp::setStartupState(STATE_SEED_CAP_GRANTED);
+ }
+
+ if (impl->mSeedCapAttempts > impl->mSeedCapMaxAttempts)
+ {
+ // *TODO: Give a user pop-up about this error?
+ LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << impl->mSeedCapAttempts << " attempts. Giving up!" << LL_ENDL;
return; // this error condition is not recoverable.
}
- S32 id = ++mHttpResponderID;
+ S32 id = ++(impl->mHttpResponderID);
LLSD capabilityNames = LLSD::emptyArray();
- buildCapabilityNames(capabilityNames);
+ impl->buildCapabilityNames(capabilityNames);
LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url
<< " region name " << regionp->getName()
<< " region id " << regionp->getRegionID()
<< " handle " << regionp->getHandle()
- << " (attempt #" << mSeedCapAttempts + 1 << ")" << LL_ENDL;
+ << " (attempt #" << impl->mSeedCapAttempts + 1 << ")" << LL_ENDL;
LL_DEBUGS("AppInit", "Capabilities") << "Capabilities requested: " << capabilityNames << LL_ENDL;
regionp = NULL;
+ impl = NULL;
result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames);
if (STATE_WORLD_INIT > LLStartUp::getStartupState())
@@ -315,8 +324,6 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
return;
}
- ++mSeedCapAttempts;
-
regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle);
if (!regionp) //region was removed
{
@@ -324,7 +331,11 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
return; // this error condition is not recoverable.
}
- if (id != mHttpResponderID) // region is no longer referring to this request
+ impl = regionp->getRegionImplNC();
+
+ ++impl->mSeedCapAttempts;
+
+ if (id != impl->mHttpResponderID) // region is no longer referring to this request
{
LL_WARNS("AppInit", "Capabilities") << "Received results for a stale capabilities request!" << LL_ENDL;
// setup for retry.
@@ -376,7 +387,6 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
{ // *HACK: we're waiting for the ServerReleaseNotes
regionp->showReleaseNotes();
}
-
}
@@ -442,6 +452,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
LL_WARNS("AppInit", "Capabilities") << "Received capabilities for region that no longer exists!" << LL_ENDL;
break; // this error condition is not recoverable.
}
+ LLViewerRegionImpl* impl = regionp->getRegionImplNC();
// remove the http_result from the llsd
result.erase("http_result");
@@ -454,30 +465,30 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
}
#if 0
- log_capabilities(mCapabilities);
+ log_capabilities(impl->mCapabilities);
#endif
- if (mCapabilities.size() != mSecondCapabilitiesTracker.size())
+ if (impl->mCapabilities.size() != impl->mSecondCapabilitiesTracker.size())
{
LL_WARNS("AppInit", "Capabilities")
<< "Sim sent duplicate base caps that differ in size from what we initially received - most likely content. "
- << "mCapabilities == " << mCapabilities.size()
- << " mSecondCapabilitiesTracker == " << mSecondCapabilitiesTracker.size()
+ << "mCapabilities == " << impl->mCapabilities.size()
+ << " mSecondCapabilitiesTracker == " << impl->mSecondCapabilitiesTracker.size()
<< LL_ENDL;
#ifdef DEBUG_CAPS_GRANTS
LL_WARNS("AppInit", "Capabilities")
<< "Initial Base capabilities: " << LL_ENDL;
- log_capabilities(mCapabilities);
+ log_capabilities(impl->mCapabilities);
LL_WARNS("AppInit", "Capabilities")
<< "Latest base capabilities: " << LL_ENDL;
- log_capabilities(mSecondCapabilitiesTracker);
+ log_capabilities(impl->mSecondCapabilitiesTracker);
#endif
- if (mSecondCapabilitiesTracker.size() > mCapabilities.size())
+ if (impl->mSecondCapabilitiesTracker.size() > impl->mCapabilities.size())
{
// *HACK Since we were granted more base capabilities in this grant request than the initial, replace
// the old with the new. This shouldn't happen i.e. we should always get the same capabilities from a
@@ -485,19 +496,17 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
// inventory api capability grants.
// Need to clear a std::map before copying into it because old keys take precedence.
- mCapabilities.clear();
- mCapabilities = mSecondCapabilitiesTracker;
+ impl->mCapabilities.clear();
+ impl->mCapabilities = impl->mSecondCapabilitiesTracker;
}
}
else
{
LL_DEBUGS("CrossingCaps") << "Sim sent multiple base cap grants with matching sizes." << LL_ENDL;
}
- mSecondCapabilitiesTracker.clear();
+ impl->mSecondCapabilitiesTracker.clear();
}
while (false);
-
-
}
void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 regionHandle)
@@ -1441,7 +1450,12 @@ void LLViewerRegion::clearCachedVisibleObjects()
for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin();
iter != mImpl->mActiveSet.end(); ++iter)
{
- LLDrawable* drawablep = (LLDrawable*)(*iter)->getEntry()->getDrawable();
+ LLVOCacheEntry* vo_entry = *iter;
+ if (!vo_entry || !vo_entry->getEntry())
+ {
+ continue;
+ }
+ LLDrawable* drawablep = (LLDrawable*)vo_entry->getEntry()->getDrawable();
if(drawablep && !drawablep->getParent())
{
@@ -2224,7 +2238,7 @@ void LLViewerRegion::requestSimulatorFeatures()
{
std::string coroname =
LLCoros::instance().launch("LLViewerRegionImpl::requestSimulatorFeatureCoro",
- boost::bind(&LLViewerRegionImpl::requestSimulatorFeatureCoro, mImpl, url, getHandle()));
+ boost::bind(&LLViewerRegionImpl::requestSimulatorFeatureCoro, url, getHandle()));
LL_INFOS("AppInit", "SimulatorFeatures") << "Launching " << coroname << " requesting simulator features from " << url << " for region " << getRegionID() << LL_ENDL;
}
@@ -3042,7 +3056,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
//to the "original" seed cap received and determine why there is problem!
std::string coroname =
LLCoros::instance().launch("LLEnvironmentRequest::requestBaseCapabilitiesCompleteCoro",
- boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro, mImpl, getHandle()));
+ boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro, getHandle()));
return;
}
@@ -3054,7 +3068,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
std::string coroname =
LLCoros::instance().launch("LLViewerRegionImpl::requestBaseCapabilitiesCoro",
- boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCoro, mImpl, getHandle()));
+ boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCoro, getHandle()));
LL_INFOS("AppInit", "Capabilities") << "Launching " << coroname << " requesting seed capabilities from " << url << " for region " << getRegionID() << LL_ENDL;
}