summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp83
1 files changed, 43 insertions, 40 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index bd35259670..bd6877d9d3 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -62,8 +62,7 @@
#include "llsdutil.h"
#include <deque>
-const U32 LLInventoryFetchItemsObserver::MAX_NUM_ATTEMPTS_TO_PROCESS = 10;
-const F32 LLInventoryFetchItemsObserver::FETCH_TIMER_EXPIRY = 10.0f;
+const F32 LLInventoryFetchItemsObserver::FETCH_TIMER_EXPIRY = 60.0f;
LLInventoryObserver::LLInventoryObserver()
@@ -143,52 +142,47 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
}
LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) :
- LLInventoryFetchObserver(item_id),
-
- mNumTries(MAX_NUM_ATTEMPTS_TO_PROCESS)
+ LLInventoryFetchObserver(item_id)
{
mIDs.clear();
mIDs.push_back(item_id);
}
LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) :
- LLInventoryFetchObserver(item_ids),
-
- mNumTries(MAX_NUM_ATTEMPTS_TO_PROCESS)
+ LLInventoryFetchObserver(item_ids)
{
}
void LLInventoryFetchItemsObserver::changed(U32 mask)
{
+ lldebugs << this << " remaining incomplete " << mIncomplete.size()
+ << " complete " << mComplete.size()
+ << " wait period " << mFetchingPeriod.getRemainingTimeF32()
+ << llendl;
+
// scan through the incomplete items and move or erase them as
// appropriate.
if (!mIncomplete.empty())
{
- // if period of an attempt expired...
- if (mFetchingPeriod.hasExpired())
- {
- // ...reset timer and reduce count of attempts
- mFetchingPeriod.reset();
- mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
-
- --mNumTries;
- LL_INFOS("InventoryFetch") << "LLInventoryFetchItemsObserver: " << this << ", attempt(s) left: " << (S32)mNumTries << LL_ENDL;
- }
-
- // do we still have any attempts?
- bool timeout_expired = mNumTries <= 0;
+ // Have we exceeded max wait time?
+ bool timeout_expired = mFetchingPeriod.hasExpired();
for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
{
const LLUUID& item_id = (*it);
LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (!item)
+ if (item && item->isFinished())
+ {
+ mComplete.push_back(item_id);
+ it = mIncomplete.erase(it);
+ }
+ else
{
if (timeout_expired)
{
// Just concede that this item hasn't arrived in reasonable time and continue on.
- LL_WARNS("InventoryFetch") << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL;
+ llwarns << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL;
it = mIncomplete.erase(it);
}
else
@@ -196,22 +190,16 @@ void LLInventoryFetchItemsObserver::changed(U32 mask)
// Keep trying.
++it;
}
- continue;
- }
- if (item->isFinished())
- {
- mComplete.push_back(item_id);
- it = mIncomplete.erase(it);
- continue;
}
- ++it;
}
- if (mIncomplete.empty())
- {
- mNumTries = MAX_NUM_ATTEMPTS_TO_PROCESS;
- done();
- }
+ }
+
+ if (mIncomplete.empty())
+ {
+ lldebugs << this << " done at remaining incomplete "
+ << mIncomplete.size() << " complete " << mComplete.size() << llendl;
+ done();
}
//llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl;
//llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl;
@@ -308,7 +296,16 @@ void LLInventoryFetchItemsObserver::startFetch()
// assume it's agent inventory.
owner_id = gAgent.getID();
}
-
+
+ // Ignore categories since they're not items. We
+ // could also just add this to mComplete but not sure what the
+ // side-effects would be, so ignoring to be safe.
+ LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
+ if (cat)
+ {
+ continue;
+ }
+
// It's incomplete, so put it on the incomplete container, and
// pack this on the message.
mIncomplete.push_back(*it);
@@ -320,8 +317,8 @@ void LLInventoryFetchItemsObserver::startFetch()
items_llsd.append(item_entry);
}
- mFetchingPeriod.resetWithExpiry(FETCH_TIMER_EXPIRY);
- mNumTries = MAX_NUM_ATTEMPTS_TO_PROCESS;
+ mFetchingPeriod.reset();
+ mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY);
fetch_items_from_llsd(items_llsd);
}
@@ -514,8 +511,14 @@ void LLInventoryAddItemByAssetObserver::changed(U32 mask)
return;
}
- LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
LLMessageSystem* msg = gMessageSystem;
+ if (!(msg->getMessageName() && (0 == strcmp(msg->getMessageName(), "UpdateCreateInventoryItem"))))
+ {
+ // this is not our message
+ return; // to prevent a crash. EXT-7921;
+ }
+
+ LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
for(S32 i = 0; i < num_blocks; ++i)
{