diff options
author | Callum Prentice <callum@gmail.com> | 2020-09-22 13:07:39 -0700 |
---|---|---|
committer | Callum Prentice <callum@gmail.com> | 2020-09-22 13:07:39 -0700 |
commit | 38faec3b11d27c2f88b89283fe1a3a60d6ec4e42 (patch) | |
tree | cc2c7f22a38a2efba72eeb01124c3f873c3a1f83 /indra/newview/lllandmarklist.cpp | |
parent | 14b5d490c37d234db7a52295502b130723186f3c (diff) | |
parent | 60ed688026269568a9eef67437dc780f88c92871 (diff) |
Merge branch 'master' into DRTVWR-519
Diffstat (limited to 'indra/newview/lllandmarklist.cpp')
-rw-r--r-- | indra/newview/lllandmarklist.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index a139d138f8..5661b2525b 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -39,6 +39,11 @@ // Globals LLLandmarkList gLandmarkList; +// number is mostly arbitrary, but it should be below DEFAULT_QUEUE_SIZE pool size, +// which is 4096, to not overfill the pool if user has more than 4K of landmarks, +// and low number helps with not flooding server with requests +const S32 MAX_SIMULTANEOUS_REQUESTS = 512; + //////////////////////////////////////////////////////////////////////////// // LLLandmarkList @@ -69,6 +74,11 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t { return NULL; } + if ( mWaitList.find(asset_uuid) != mWaitList.end() ) + { + // Landmark is sheduled for download, but not requested yet + return NULL; + } landmark_requested_list_t::iterator iter = mRequestedList.find(asset_uuid); if (iter != mRequestedList.end()) @@ -86,6 +96,13 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t mLoadedCallbackMap.insert(vt); } + if (mRequestedList.size() > MAX_SIMULTANEOUS_REQUESTS) + { + // Postpone download till queu is emptier + mWaitList.insert(asset_uuid); + return NULL; + } + gAssetStorage->getAssetData(asset_uuid, LLAssetType::AT_LANDMARK, LLLandmarkList::processGetAssetReply, @@ -154,8 +171,22 @@ void LLLandmarkList::processGetAssetReply( } gLandmarkList.mBadList.insert(uuid); + gLandmarkList.mRequestedList.erase(uuid); //mBadList effectively blocks any load, so no point keeping id in requests + // todo: this should clean mLoadedCallbackMap! } + if (!gLandmarkList.mWaitList.empty()) + { + // start new download from wait list + landmark_uuid_list_t::iterator iter = gLandmarkList.mWaitList.begin(); + LLUUID asset_uuid = *iter; + gLandmarkList.mWaitList.erase(iter); + gAssetStorage->getAssetData(asset_uuid, + LLAssetType::AT_LANDMARK, + LLLandmarkList::processGetAssetReply, + NULL); + gLandmarkList.mRequestedList[asset_uuid] = gFrameTimeSeconds; + } } BOOL LLLandmarkList::isAssetInLoadedCallbackMap(const LLUUID& asset_uuid) |