diff options
author | callum_linden <none@none> | 2015-05-18 12:00:36 -0700 |
---|---|---|
committer | callum_linden <none@none> | 2015-05-18 12:00:36 -0700 |
commit | 80aa29eaec78d267b4fa1822cfbd3a33b268066a (patch) | |
tree | 1ce0483bd490750e367bfe53a19ec312cdc0bd27 /indra/newview/llinventorymodelbackgroundfetch.cpp | |
parent | d214c2854110520d5574f675bcc12f64bfd42090 (diff) | |
parent | fde0868231a25b8c9ce03a86cb53f1738d35688d (diff) |
Merge with Viewer Release (after Viewer Release updated with Viewer Tools Update)
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rwxr-xr-x | indra/newview/llinventorymodelbackgroundfetch.cpp | 166 |
1 files changed, 2 insertions, 164 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index f18832fe95..40edb13a80 100755 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -181,8 +181,6 @@ private: }; -const S32 MAX_FETCH_RETRIES = 10; - const char * const LOG_INV("Inventory"); } // end of namespace anonymous @@ -199,10 +197,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch(): mAllFoldersFetched(FALSE), mRecursiveInventoryFetchStarted(FALSE), mRecursiveLibraryFetchStarted(FALSE), - mNumFetchRetries(0), - mMinTimeBetweenFetches(0.3f), - mMaxTimeBetweenFetches(10.f), - mTimelyFetchPending(FALSE) + mMinTimeBetweenFetches(0.3f) {} LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() @@ -351,164 +346,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() if (mBackgroundFetchActive && gAgent.getRegion() && gAgent.getRegion()->capabilitiesReceived()) { // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - if (gSavedSettings.getBOOL("UseHTTPInventory")) - { - bulkFetch(); - return; - } - -#if 1 - //-------------------------------------------------------------------------------- - // DEPRECATED OLD CODE - // - - // No more categories to fetch, stop fetch process. - if (mFetchQueue.empty()) - { - setAllFoldersFetched(); - return; - } - - F32 fast_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.1f); - F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f); - if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time) - { - // Double timeouts on failure. - mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f); - mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f); - LL_DEBUGS(LOG_INV) << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << LL_ENDL; - // fetch is no longer considered "timely" although we will wait for full time-out. - mTimelyFetchPending = FALSE; - } - - while(1) - { - if (mFetchQueue.empty()) - { - break; - } - - if (gDisconnected) - { - // Just bail if we are disconnected. - break; - } - - const FetchQueueInfo info = mFetchQueue.front(); - - if (info.mIsCategory) - { - - LLViewerInventoryCategory* cat = gInventory.getCategory(info.mUUID); - - // Category has been deleted, remove from queue. - if (!cat) - { - mFetchQueue.pop_front(); - continue; - } - - if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && - LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) - { - // Category exists but has no children yet, fetch the descendants - // for now, just request every time and rely on retry timer to throttle. - if (cat->fetch()) - { - mFetchTimer.reset(); - mTimelyFetchPending = TRUE; - } - else - { - // The catagory also tracks if it has expired and here it says it hasn't - // yet. Get out of here because nothing is going to happen until we - // update the timers. - break; - } - } - // Do I have all my children? - else if (gInventory.isCategoryComplete(info.mUUID)) - { - // Finished with this category, remove from queue. - mFetchQueue.pop_front(); - - // Add all children to queue. - LLInventoryModel::cat_array_t* categories; - LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); - for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); - it != categories->end(); - ++it) - { - mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive)); - } - - // We received a response in less than the fast time. - if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time) - { - // Shrink timeouts based on success. - mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f); - mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f); - LL_DEBUGS(LOG_INV) << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << LL_ENDL; - } - - mTimelyFetchPending = FALSE; - continue; - } - else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches) - { - // Received first packet, but our num descendants does not match db's num descendants - // so try again later. - mFetchQueue.pop_front(); - - if (mNumFetchRetries++ < MAX_FETCH_RETRIES) - { - // push on back of queue - mFetchQueue.push_back(info); - } - mTimelyFetchPending = FALSE; - mFetchTimer.reset(); - break; - } - - // Not enough time has elapsed to do a new fetch - break; - } - else - { - LLViewerInventoryItem* itemp = gInventory.getItem(info.mUUID); - - mFetchQueue.pop_front(); - if (!itemp) - { - continue; - } - - if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches) - { - itemp->fetchFromServer(); - mFetchTimer.reset(); - mTimelyFetchPending = TRUE; - } - else if (itemp->mIsComplete) - { - mTimelyFetchPending = FALSE; - } - else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches) - { - mFetchQueue.push_back(info); - mFetchTimer.reset(); - mTimelyFetchPending = FALSE; - } - // Not enough time has elapsed to do a new fetch - break; - } - } - - // - // DEPRECATED OLD CODE - //-------------------------------------------------------------------------------- -#endif + bulkFetch(); } } |