Commit c39e276b authored by Drake Arconis's avatar Drake Arconis
Browse files

Remove old UDP inventory fetch.

parent 4584faa0
...@@ -51,9 +51,7 @@ ...@@ -51,9 +51,7 @@
// along with inventory LINK items referencing other inventory // along with inventory LINK items referencing other inventory
// items. As part of this, at login, the entire inventory // items. As part of this, at login, the entire inventory
// structure is downloaded 'in the background' using the // structure is downloaded 'in the background' using the
// backgroundFetch()/bulkFetch() methods. The UDP path can // backgroundFetch()/bulkFetch() methods.
// still be used and is found in the 'DEPRECATED OLD CODE'
// section.
// //
// The old UDP path implemented a throttle that adapted // The old UDP path implemented a throttle that adapted
// itself during running. The mechanism survived info HTTP // itself during running. The mechanism survived info HTTP
...@@ -184,8 +182,6 @@ private: ...@@ -184,8 +182,6 @@ private:
}; };
const S32 MAX_FETCH_RETRIES = 10;
const char * const LOG_INV("Inventory"); const char * const LOG_INV("Inventory");
} // end of namespace anonymous } // end of namespace anonymous
...@@ -196,16 +192,13 @@ const char * const LOG_INV("Inventory"); ...@@ -196,16 +192,13 @@ const char * const LOG_INV("Inventory");
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch(): LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch():
mRecursiveInventoryFetchStarted(FALSE), mRecursiveInventoryFetchStarted(false),
mRecursiveLibraryFetchStarted(FALSE), mRecursiveLibraryFetchStarted(false),
mAllFoldersFetched(FALSE), mAllFoldersFetched(false),
mBackgroundFetchActive(FALSE), mBackgroundFetchActive(false),
mFolderFetchActive(false), mFolderFetchActive(false),
mFetchCount(0), mFetchCount(0),
mTimelyFetchPending(FALSE), mMinTimeBetweenFetches(0.3f)
mNumFetchRetries(0),
mMinTimeBetweenFetches(0.3f),
mMaxTimeBetweenFetches(10.f)
{} {}
LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
...@@ -251,22 +244,22 @@ bool LLInventoryModelBackgroundFetch::isEverythingFetched() const ...@@ -251,22 +244,22 @@ bool LLInventoryModelBackgroundFetch::isEverythingFetched() const
return mAllFoldersFetched; return mAllFoldersFetched;
} }
BOOL LLInventoryModelBackgroundFetch::folderFetchActive() const bool LLInventoryModelBackgroundFetch::folderFetchActive() const
{ {
return mFolderFetchActive; return mFolderFetchActive;
} }
void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID & id, BOOL recursive, bool is_category) void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID & id, bool recursive, bool is_category)
{ {
mFetchQueue.push_front(FetchQueueInfo(id, recursive, is_category)); mFetchQueue.push_front(FetchQueueInfo(id, recursive, is_category));
} }
void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID & id, BOOL recursive, bool is_category) void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID & id, bool recursive, bool is_category)
{ {
mFetchQueue.push_back(FetchQueueInfo(id, recursive, is_category)); mFetchQueue.push_back(FetchQueueInfo(id, recursive, is_category));
} }
void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive) void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
{ {
LLViewerInventoryCategory * cat(gInventory.getCategory(id)); LLViewerInventoryCategory * cat(gInventory.getCategory(id));
...@@ -275,7 +268,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive) ...@@ -275,7 +268,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive)
// it's a folder, do a bulk fetch // it's a folder, do a bulk fetch
LL_DEBUGS(LOG_INV) << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL; LL_DEBUGS(LOG_INV) << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL;
mBackgroundFetchActive = TRUE; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
if (id.isNull()) if (id.isNull())
{ {
...@@ -314,7 +307,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive) ...@@ -314,7 +307,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive)
{ {
if (! itemp->mIsComplete && (mFetchQueue.empty() || mFetchQueue.front().mUUID != id)) if (! itemp->mIsComplete && (mFetchQueue.empty() || mFetchQueue.front().mUUID != id))
{ {
mBackgroundFetchActive = TRUE; mBackgroundFetchActive = true;
mFetchQueue.push_front(FetchQueueInfo(id, false, false)); mFetchQueue.push_front(FetchQueueInfo(id, false, false));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
...@@ -324,9 +317,9 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive) ...@@ -324,9 +317,9 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive)
void LLInventoryModelBackgroundFetch::findLostItems() void LLInventoryModelBackgroundFetch::findLostItems()
{ {
mBackgroundFetchActive = TRUE; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, TRUE)); mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, true));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
...@@ -335,7 +328,7 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched() ...@@ -335,7 +328,7 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
if (mRecursiveInventoryFetchStarted && if (mRecursiveInventoryFetchStarted &&
mRecursiveLibraryFetchStarted) mRecursiveLibraryFetchStarted)
{ {
mAllFoldersFetched = TRUE; mAllFoldersFetched = true;
//LL_INFOS(LOG_INV) << "All folders fetched, validating" << LL_ENDL; //LL_INFOS(LOG_INV) << "All folders fetched, validating" << LL_ENDL;
//gInventory.validate(); //gInventory.validate();
} }
...@@ -353,165 +346,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() ...@@ -353,165 +346,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
{ {
if (mBackgroundFetchActive && gAgent.getRegion() && gAgent.getRegion()->capabilitiesReceived()) 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. bulkFetch();
if (LLGridManager::instance().isInSecondlife() || 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
} }
} }
...@@ -982,7 +817,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http ...@@ -982,7 +817,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
{ {
LLSD folder_sd(*folder_it); LLSD folder_sd(*folder_it);
LLUUID folder_id(folder_sd["folder_id"].asUUID()); LLUUID folder_id(folder_sd["folder_id"].asUUID());
const BOOL recursive = getIsRecursive(folder_id); const bool recursive = getIsRecursive(folder_id);
fetcher->addRequestAtFront(folder_id, recursive, true); fetcher->addRequestAtFront(folder_id, recursive, true);
} }
} }
...@@ -1020,7 +855,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http ...@@ -1020,7 +855,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http
{ {
LLSD folder_sd(*folder_it); LLSD folder_sd(*folder_it);
LLUUID folder_id(folder_sd["folder_id"].asUUID()); LLUUID folder_id(folder_sd["folder_id"].asUUID());
const BOOL recursive = getIsRecursive(folder_id); const bool recursive = getIsRecursive(folder_id);
fetcher->addRequestAtFront(folder_id, recursive, true); fetcher->addRequestAtFront(folder_id, recursive, true);
} }
} }
......
...@@ -49,9 +49,9 @@ public: ...@@ -49,9 +49,9 @@ public:
// Start and stop background breadth-first fetching of inventory contents. // Start and stop background breadth-first fetching of inventory contents.
// This gets triggered when performing a filter-search. // This gets triggered when performing a filter-search.
void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE); void start(const LLUUID& cat_id = LLUUID::null, bool recursive = true);
BOOL folderFetchActive() const; bool folderFetchActive() const;
bool isEverythingFetched() const; // completing the fetch once per session should be sufficient bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
bool libraryFetchStarted() const; bool libraryFetchStarted() const;
...@@ -68,8 +68,8 @@ public: ...@@ -68,8 +68,8 @@ public:
bool isBulkFetchProcessingComplete() const; bool isBulkFetchProcessingComplete() const;
void setAllFoldersFetched(); void setAllFoldersFetched();
void addRequestAtFront(const LLUUID & id, BOOL recursive, bool is_category); void addRequestAtFront(const LLUUID & id, bool recursive, bool is_category);
void addRequestAtBack(const LLUUID & id, BOOL recursive, bool is_category); void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category);
protected: protected:
void bulkFetch(); void bulkFetch();
...@@ -80,23 +80,21 @@ protected: ...@@ -80,23 +80,21 @@ protected:
bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const; bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
private: private:
BOOL mRecursiveInventoryFetchStarted; bool mRecursiveInventoryFetchStarted;
BOOL mRecursiveLibraryFetchStarted; bool mRecursiveLibraryFetchStarted;
BOOL mAllFoldersFetched; bool mAllFoldersFetched;
BOOL mBackgroundFetchActive; bool mBackgroundFetchActive;
bool mFolderFetchActive; bool mFolderFetchActive;
S32 mFetchCount; S32 mFetchCount;
BOOL mTimelyFetchPending;
S32 mNumFetchRetries;
LLFrameTimer mFetchTimer; LLFrameTimer mFetchTimer;
F32 mMinTimeBetweenFetches; F32 mMinTimeBetweenFetches;
F32 mMaxTimeBetweenFetches;
struct FetchQueueInfo struct FetchQueueInfo
{ {
FetchQueueInfo(const LLUUID& id, BOOL recursive, bool is_category = true) FetchQueueInfo(const LLUUID& id, bool recursive, bool is_category = true)
: mUUID(id), : mUUID(id),
mIsCategory(is_category), mIsCategory(is_category),
mRecursive(recursive) mRecursive(recursive)
...@@ -104,7 +102,7 @@ private: ...@@ -104,7 +102,7 @@ private:
LLUUID mUUID; LLUUID mUUID;
bool mIsCategory; bool mIsCategory;
BOOL mRecursive; bool mRecursive;
}; };
typedef std::deque<FetchQueueInfo> fetch_queue_t; typedef std::deque<FetchQueueInfo> fetch_queue_t;
fetch_queue_t mFetchQueue; fetch_queue_t mFetchQueue;
......
...@@ -2910,15 +2910,12 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) ...@@ -2910,15 +2910,12 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("FlickrConnect"); capabilityNames.append("FlickrConnect");
capabilityNames.append("TwitterConnect"); capabilityNames.append("TwitterConnect");
if (gSavedSettings.getBOOL("UseHTTPInventory")) capabilityNames.append("FetchLib2");
{ capabilityNames.append("FetchLibDescendents2");
capabilityNames.append("FetchLib2"); capabilityNames.append("FetchInventory2");
capabilityNames.append("FetchLibDescendents2"); capabilityNames.append("FetchInventoryDescendents2");
capabilityNames.append("FetchInventory2"); capabilityNames.append("IncrementCOFVersion");
capabilityNames.append("FetchInventoryDescendents2"); AISAPI::getCapNames(capabilityNames);
capabilityNames.append("IncrementCOFVersion");
AISAPI::getCapNames(capabilityNames);
}
capabilityNames.append("GetDisplayNames"); capabilityNames.append("GetDisplayNames");
capabilityNames.append("GetExperiences"); capabilityNames.append("GetExperiences");
......
...@@ -3832,19 +3832,6 @@ ...@@ -3832,19 +3832,6 @@
function="ToggleControl" function="ToggleControl"
parameter="ImagePipelineUseHTTP" /> parameter="ImagePipelineUseHTTP" />
</menu_item_check> </menu_item_check>
<menu_item_check
label="HTTP Inventory"
name="HTTP Inventory">
<menu_item_check.on_check
function="CheckControl"
parameter="UseHTTPInventory" />
<menu_item_check.on_click
function="ToggleControl"
parameter="UseHTTPInventory" />
<menu_item_check.on_visible
function="EnableGrid"
parameter="opensim" />
</menu_item_check>
<menu_item_call <menu_item_call
label="Compress Images" label="Compress Images"
name="Compress Images"> name="Compress Images">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment