diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-10-05 01:14:30 +0300 |
---|---|---|
committer | akleshchev <117672381+akleshchev@users.noreply.github.com> | 2023-10-10 21:07:12 +0300 |
commit | 7b2dfc4e826775017218100ee17b2afe2151da4c (patch) | |
tree | 76a62e920b5c74c96ff20d03675e4e69fa9e7a64 /indra/newview/lltexturefetch.cpp | |
parent | fa368f8bcdbf991064cf3350f29c733fec7d21c8 (diff) |
SL-19311 Grey textures after teleport
There is no asset capability during teleport and it can take some time
to arrive, texture shouldn't just fail to fetch if capability arrives
after content.
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 95 |
1 files changed, 79 insertions, 16 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index fd46d54a1d..e669393dba 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -239,6 +239,10 @@ static const S32 HTTP_NONPIPE_REQUESTS_LOW_WATER = 20; // request (e.g. 'Range: <start>-') which seems to fix the problem. static const S32 HTTP_REQUESTS_RANGE_END_MAX = 20000000; +// stop after 720 seconds, might be overkill, but cap request can keep going forever. +static const S32 MAX_CAP_MISSING_RETRIES = 720; +static const S32 CAP_MISSING_EXPIRATION_DELAY = 1; // seconds + ////////////////////////////////////////////////////////////////////////////// namespace { @@ -526,6 +530,7 @@ private: e_state mState; void setState(e_state new_state); + LLViewerRegion* getRegion(); e_write_to_cache_state mWriteToCacheState; LLTextureFetch* mFetcher; @@ -579,6 +584,10 @@ private: LLCore::HttpStatus mGetStatus; std::string mGetReason; LLAdaptiveRetryPolicy mFetchRetryPolicy; + bool mCanUseCapability; + LLTimer mRegionRetryTimer; + S32 mRegionRetryAttempt; + LLUUID mLastRegionId; // Work Data @@ -928,7 +937,9 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mCacheReadCount(0U), mCacheWriteCount(0U), mResourceWaitCount(0U), - mFetchRetryPolicy(10.f,3600.f,2.f,10) + mFetchRetryPolicy(10.f,3600.f,2.f,10), + mCanUseCapability(true), + mRegionRetryAttempt(0) { mType = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL; // LL_INFOS(LOG_TXT) << "Create: " << mID << " mHost:" << host << " Discard=" << discard << LL_ENDL; @@ -1089,6 +1100,18 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; // abort } } + if (mState > CACHE_POST && !mCanUseCapability && mCanUseHTTP) + { + if (mRegionRetryAttempt > MAX_CAP_MISSING_RETRIES) + { + mCanUseHTTP = false; + } + else if (!mRegionRetryTimer.hasExpired()) + { + return false; + } + // else retry + } if(mState > CACHE_POST && !mCanUseHTTP) { LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("tfwdw - state > cache_post"); @@ -1290,16 +1313,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // if (mHost.isInvalid()) get_url = false; if ( use_http && mCanUseHTTP && mUrl.empty())//get http url. { - LLViewerRegion* region = NULL; - if (mHost.isInvalid()) - { - region = gAgent.getRegion(); - } - else if (LLWorld::instanceExists()) - { - region = LLWorld::getInstance()->getRegion(mHost); - } - + LLViewerRegion* region = getRegion(); if (region) { std::string http_url = region->getViewerAssetUrl(); @@ -1312,19 +1326,27 @@ bool LLTextureFetchWorker::doWork(S32 param) setUrl(http_url + "/?texture_id=" + mID.asString().c_str()); LL_DEBUGS(LOG_TXT) << "Texture URL: " << mUrl << LL_ENDL; mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id. + mCanUseCapability = true; + mRegionRetryAttempt = 0; + mLastRegionId = region->getRegionID(); } else { - mCanUseHTTP = false ; - LL_WARNS(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL; + mCanUseCapability = false; + mRegionRetryAttempt++; + mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY); + // ex: waiting for caps + LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL; } } else { + mCanUseCapability = false; + mRegionRetryAttempt++; + mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY); // This will happen if not logged in or if a region deoes not have HTTP Texture enabled //LL_WARNS(LOG_TXT) << "Region not found for host: " << mHost << LL_ENDL; - LL_WARNS(LOG_TXT) << "Texture not available via HTTP: no region " << mUrl << LL_ENDL; - mCanUseHTTP = false; + LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: no region " << mUrl << LL_ENDL; } } else if (mFTType == FTT_SERVER_BAKE) @@ -1332,7 +1354,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mWriteToCacheState = CAN_WRITE; } - if (mCanUseHTTP && !mUrl.empty()) + if (mCanUseCapability && mCanUseHTTP && !mUrl.empty()) { setState(WAIT_HTTP_RESOURCE); if(mWriteToCacheState != NOT_WRITE) @@ -1534,10 +1556,37 @@ bool LLTextureFetchWorker::doWork(S32 param) } return true; } + + if (mCanUseHTTP && !mUrl.empty() && cur_size <= 0) + { + LLViewerRegion* region = getRegion(); + if (!region || mLastRegionId != region->getRegionID()) + { + // cap failure? try on new region. + mUrl.clear(); + ++mRetryAttempt; + mLastRegionId.setNull(); + setState(INIT); + return false; + } + } } else if (http_service_unavail == mGetStatus) { LL_INFOS_ONCE(LOG_TXT) << "Texture server busy (503): " << mUrl << LL_ENDL; + if (mCanUseHTTP && !mUrl.empty() && cur_size <= 0) + { + LLViewerRegion* region = getRegion(); + if (!region || mLastRegionId != region->getRegionID()) + { + // try on new region. + mUrl.clear(); + ++mRetryAttempt; + mLastRegionId.setNull(); + setState(INIT); + return false; + } + } } else if (http_not_sat == mGetStatus) { @@ -3054,6 +3103,20 @@ void LLTextureFetchWorker::setState(e_state new_state) mState = new_state; } +LLViewerRegion* LLTextureFetchWorker::getRegion() +{ + LLViewerRegion* region = NULL; + if (mHost.isInvalid()) + { + region = gAgent.getRegion(); + } + else if (LLWorld::instanceExists()) + { + region = LLWorld::getInstance()->getRegion(mHost); + } + return region; +} + ////////////////////////////////////////////////////////////////////////////// // Threads: T* |