diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentwearablesfetch.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llgesturemgr.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llinventoryobserver.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llinventoryobserver.h | 10 |
4 files changed, 33 insertions, 31 deletions
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index aafbb0d22c..08d8ccfd23 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -91,7 +91,7 @@ class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver { public: LLFetchAndLinkObserver(uuid_vec_t& ids): - LLInventoryFetchItemsObserver(ids, true) // retry for missing items + LLInventoryFetchItemsObserver(ids) { } ~LLFetchAndLinkObserver() diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 3d38ff3730..0996d09e25 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -73,7 +73,6 @@ LLGestureMgr::LLGestureMgr() mActive(), mLoadingCount(0) { - mRetryIfMissing = true; gInventory.addObserver(this); } diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 26fe1904fb..fb2ef01c8f 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -62,6 +62,14 @@ #include "llsdutil.h" #include <deque> +// If the viewer gets a notification, your observer assumes +// that that notification is for itself and then tries to process +// the results. The notification could be for something else (e.g. +// you're fetching an item and a notification gets triggered because +// you renamed some other item). This counter is to specify how many +// notification to wait for before giving up. +static const U32 MAX_NUM_NOTIFICATIONS_TO_PROCESS = 20; + LLInventoryObserver::LLInventoryObserver() { } @@ -138,66 +146,63 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id) } } -/* -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(BOOL retry_if_missing) : - mRetryIfMissing(retry_if_missing) -{ -} -*/ - -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id, - BOOL retry_if_missing) : +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) : LLInventoryFetchObserver(item_id), - mRetryIfMissing(retry_if_missing) + mNumTries(MAX_NUM_NOTIFICATIONS_TO_PROCESS) { mIDs.clear(); mIDs.push_back(item_id); } -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, - BOOL retry_if_missing) : - LLInventoryFetchObserver(item_ids), - mRetryIfMissing(retry_if_missing) +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) : + LLInventoryFetchObserver(item_ids) { } void LLInventoryFetchItemsObserver::changed(U32 mask) { + BOOL any_items_missing = FALSE; + // scan through the incomplete items and move or erase them as // appropriate. if (!mIncomplete.empty()) { for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { - LLViewerInventoryItem* item = gInventory.getItem(*it); + const LLUUID& item_id = (*it); + LLViewerInventoryItem* item = gInventory.getItem(item_id); if (!item) { - if (mRetryIfMissing) + any_items_missing = TRUE; + if (mNumTries > 0) { - // BAP changed to skip these items, so we should keep retrying until they arrive. - // Did not make this the default behavior because of uncertainty about impact - - // could cause some observers that currently complete to wait forever. + // Keep trying. ++it; } else { - // BUG: This can cause done() to get called prematurely below. - // This happens with the LLGestureInventoryFetchObserver that - // loads gestures at startup. JC + // Just concede that this item hasn't arrived in reasonable time and continue on. + llwarns << "Fetcher timed out when fetching inventory item assetID:" << item_id << llendl; it = mIncomplete.erase(it); } continue; } if (item->isFinished()) { - mComplete.push_back(*it); + mComplete.push_back(item_id); it = mIncomplete.erase(it); continue; } ++it; } + if (any_items_missing) + { + mNumTries--; + } + if (mIncomplete.empty()) { + mNumTries = MAX_NUM_NOTIFICATIONS_TO_PROCESS; done(); } } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 7b4d3dfe7b..ac2eca3477 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -103,15 +103,13 @@ protected: class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver { public: - LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null, - BOOL retry_if_missing = FALSE); - LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, - BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null); + LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids); /*virtual*/ void startFetch(); /*virtual*/ void changed(U32 mask); -protected: - BOOL mRetryIfMissing; +private: + S8 mNumTries; // Number of times changed() was called without success }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |