diff options
-rw-r--r-- | indra/llmessage/llcoproceduremanager.cpp | 6 | ||||
-rw-r--r-- | indra/llmessage/llcoproceduremanager.h | 1 | ||||
-rw-r--r-- | indra/newview/lllandmarklist.cpp | 31 | ||||
-rw-r--r-- | indra/newview/lllandmarklist.h | 7 |
4 files changed, 42 insertions, 3 deletions
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index 42c19e3b1c..0684f47df2 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -140,6 +140,12 @@ LLCoprocedureManager::~LLCoprocedureManager() close(); } +void LLCoprocedureManager::initSingleton() +{ + // workaround until we get mutex into initializePool + initializePool("VAssetStorage"); +} + LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::string &poolName) { // Attempt to look up a pool size in the configuration. If found use that diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h index 70204ba02b..8540ced8cc 100644 --- a/indra/llmessage/llcoproceduremanager.h +++ b/indra/llmessage/llcoproceduremanager.h @@ -40,6 +40,7 @@ class LLCoprocedureManager : public LLSingleton < LLCoprocedureManager > { LLSINGLETON(LLCoprocedureManager); virtual ~LLCoprocedureManager(); + /*virtual*/ void initSingleton(); public: typedef boost::function<U32(const std::string &)> SettingQuery_t; diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index c58540914e..1fc70cd6d6 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, @@ -155,8 +172,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) diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index 3356f866ce..2e7bd25610 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -70,9 +70,10 @@ protected: typedef std::map<LLUUID, LLLandmark*> landmark_list_t; landmark_list_t mList; - typedef std::set<LLUUID> landmark_bad_list_t; - landmark_bad_list_t mBadList; - + typedef std::set<LLUUID> landmark_uuid_list_t; + landmark_uuid_list_t mBadList; + landmark_uuid_list_t mWaitList; + typedef std::map<LLUUID,F32> landmark_requested_list_t; landmark_requested_list_t mRequestedList; |