diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llhttpretrypolicy.cpp | 7 | ||||
-rwxr-xr-x | indra/newview/llhttpretrypolicy.h | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llinventorybridge.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.cpp | 85 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.h | 11 | ||||
-rwxr-xr-x | indra/newview/llviewerinventory.cpp | 8 | ||||
-rwxr-xr-x | indra/newview/tests/llhttpretrypolicy_test.cpp | 15 |
8 files changed, 115 insertions, 35 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3c141aa37a..84a494186f 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2871,7 +2871,8 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder public: RequestAgentUpdateAppearanceResponder() { - mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10); + bool retry_on_4xx = true; + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10, retry_on_4xx); } virtual ~RequestAgentUpdateAppearanceResponder() diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp index 80d97e4362..1512b46103 100755 --- a/indra/newview/llhttpretrypolicy.cpp +++ b/indra/newview/llhttpretrypolicy.cpp @@ -28,11 +28,12 @@ #include "llhttpretrypolicy.h" -LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries): +LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx): mMinDelay(min_delay), mMaxDelay(max_delay), mBackoffFactor(backoff_factor), - mMaxRetries(max_retries) + mMaxRetries(max_retries), + mRetryOn4xx(retry_on_4xx) { init(); } @@ -108,7 +109,7 @@ void LLAdaptiveRetryPolicy::onFailureCommon(S32 status, bool has_retry_header_ti llinfos << "Too many retries " << mRetryCount << ", will not retry" << llendl; mShouldRetry = false; } - if (!isHttpServerErrorStatus(status)) + if (!mRetryOn4xx && !isHttpServerErrorStatus(status)) { llinfos << "Non-server error " << status << ", will not retry" << llendl; mShouldRetry = false; diff --git a/indra/newview/llhttpretrypolicy.h b/indra/newview/llhttpretrypolicy.h index 1fb0cac03f..5b1a1d79e0 100755 --- a/indra/newview/llhttpretrypolicy.h +++ b/indra/newview/llhttpretrypolicy.h @@ -60,7 +60,7 @@ public: class LLAdaptiveRetryPolicy: public LLHTTPRetryPolicy { public: - LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries); + LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx = false); // virtual void onSuccess(); @@ -88,6 +88,7 @@ private: U32 mRetryCount; // number of times shouldRetry has been called. LLTimer mRetryTimer; // time until next retry. bool mShouldRetry; // Becomes false after too many retries, or the wrong sort of status received, etc. + bool mRetryOn4xx; // Normally only retry on 5xx server errors. }; #endif diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 27f35c5946..abebd0aa5e 100644..100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1566,18 +1566,18 @@ void LLItemBridge::buildDisplayName() const else { mDisplayName.assign(LLStringUtil::null); -} - + } + mSearchableName.assign(mDisplayName); mSearchableName.append(getLabelSuffix()); LLStringUtil::toUpper(mSearchableName); - + //Name set, so trigger a sort if(mParent) -{ - mParent->requestSort(); - } + { + mParent->requestSort(); } +} LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const { @@ -1901,8 +1901,7 @@ void LLFolderBridge::update() possibly_has_children = true; } - bool loading = (possibly_has_children - && !up_to_date ); + bool loading = (possibly_has_children && !up_to_date ); if (loading != mIsLoading) { @@ -1929,12 +1928,13 @@ void LLFolderBridge::update() || (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && root_is_loading)) { + buildDisplayName(); mDisplayName = LLInvFVBridge::getDisplayName() + " ( " + LLTrans::getString("LoadingData") + " ) "; mIsLoading = true; } else { - mDisplayName = LLInvFVBridge::getDisplayName(); + buildDisplayName(); mIsLoading = false; } } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b49e617f62..fd57845c0e 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -48,6 +48,7 @@ #include "llcallbacklist.h" #include "llvoavatarself.h" #include "llgesturemgr.h" +#include "llsdutil.h" #include <typeinfo> //#define DIFF_INVENTORY_FILES @@ -1153,8 +1154,69 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, notifyObservers(); } +void parse_llsd_uuid_array(const LLSD& content, const std::string& name, uuid_vec_t& ids) +{ + ids.clear(); + if (content.has(name)) + { + for(LLSD::array_const_iterator it = content[name].beginArray(), + end = content[name].endArray(); + it != end; ++it) + { + ids.push_back((*it).asUUID()); + } + } +} + +void LLInventoryModel::onAISUpdateReceived(const std::string& context, const LLSD& update) +{ + llinfos << "ais update " << context << ":" << ll_pretty_print_sd(update) << llendl; + + uuid_vec_t cat_ids; + parse_llsd_uuid_array(update,"_categories_removed",cat_ids); + for (uuid_vec_t::const_iterator it = cat_ids.begin(); + it != cat_ids.end(); ++it) + { + llinfos << "remove category: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + uuid_vec_t item_ids; + parse_llsd_uuid_array(update,"_category_items_removed",item_ids); + for (uuid_vec_t::const_iterator it = item_ids.begin(); + it != item_ids.end(); ++it) + { + llinfos << "remove item: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + uuid_vec_t broken_link_ids; + parse_llsd_uuid_array(update,"_broken_links_removed",broken_link_ids); + for (uuid_vec_t::const_iterator it = broken_link_ids.begin(); + it != broken_link_ids.end(); ++it) + { + llinfos << "remove broken link: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + const std::string& ucv = "_updated_category_versions"; + if (update.has(ucv)) + { + for(LLSD::map_const_iterator it = update[ucv].beginMap(), + end = update[ucv].endMap(); + it != end; ++it) + { + const LLUUID id((*it).first); + S32 version = (*it).second.asInteger(); + llinfos << "update category: " << id << " to version " << version << llendl; + } + } + + +} + // Update model after descendents have been purged. -void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) +void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links) { LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id); if (cat.notNull()) @@ -1192,7 +1254,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) // of its deleted parent. if (getItem(uu_id)) { - deleteObject(uu_id); + deleteObject(uu_id, fix_broken_links); } } @@ -1216,7 +1278,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) cat_array_t* cat_list = getUnlockedCatArray(uu_id); if (!cat_list || (cat_list->size() == 0)) { - deleteObject(uu_id); + deleteObject(uu_id, fix_broken_links); deleted_count++; } } @@ -1235,24 +1297,30 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) // Update model after an item is confirmed as removed from // server. Works for categories or items. -void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id) +void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool fix_broken_links) { LLPointer<LLInventoryObject> obj = getObject(object_id); if(obj) { + if (getCategory(object_id)) + { + // For category, need to delete/update all children first. + onDescendentsPurgedFromServer(object_id, fix_broken_links); + } + // From item/cat removeFromServer() LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); accountForUpdate(up); // From purgeObject() LLPreview::hide(object_id); - deleteObject(object_id); + deleteObject(object_id, fix_broken_links); } } // Delete a particular inventory object by ID. -void LLInventoryModel::deleteObject(const LLUUID& id) +void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links) { lldebugs << "LLInventoryModel::deleteObject()" << llendl; LLPointer<LLInventoryObject> obj = getObject(id); @@ -1303,10 +1371,11 @@ void LLInventoryModel::deleteObject(const LLUUID& id) addChangedMask(LLInventoryObserver::REMOVE, id); // Can't have links to links, so there's no need for this update - // if the item removed is a link. + // if the item removed is a link. Can also skip if source of the + // update is getting broken link info separately. bool is_link_type = obj->getIsLinkType(); obj = NULL; // delete obj - if (!is_link_type) + if (fix_broken_links && !is_link_type) { updateLinkedObjectsFromPurge(id); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 2459f10a37..696d0a9163 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -328,19 +328,22 @@ public: // Delete //-------------------------------------------------------------------- public: - + + // Update model after an AISv3 update received for any operation. + void onAISUpdateReceived(const std::string& context, const LLSD& update); + // Update model after an item is confirmed as removed from // server. Works for categories or items. - void onObjectDeletedFromServer(const LLUUID& item_id); + void onObjectDeletedFromServer(const LLUUID& item_id, bool fix_broken_links = true); // Update model after all descendents removed from server. - void onDescendentsPurgedFromServer(const LLUUID& object_id); + void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true); // Delete a particular inventory object by ID. Will purge one // object from the internal data structures, maintaining a // consistent internal state. No cache accounting, observer // notification, or server update is performed. - void deleteObject(const LLUUID& id); + void deleteObject(const LLUUID& id, bool fix_broken_links = true); /// move Item item_id to Trash void removeItem(const LLUUID& item_id); /// move Category category_id to Trash diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index f9afdee4f9..5ffd560942 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1154,8 +1154,8 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - + gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); + // FIXME - not needed after AIS starts returning deleted item in its response. gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) @@ -1335,9 +1335,7 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - - gInventory.onDescendentsPurgedFromServer(mItemUUID); + gInventory.onAISUpdateReceived("purgeDescendentsResponder " + mItemUUID.asString(), content); if (mCallback) { diff --git a/indra/newview/tests/llhttpretrypolicy_test.cpp b/indra/newview/tests/llhttpretrypolicy_test.cpp index ed7f3ba326..25e6de46d9 100755 --- a/indra/newview/tests/llhttpretrypolicy_test.cpp +++ b/indra/newview/tests/llhttpretrypolicy_test.cpp @@ -56,12 +56,19 @@ void RetryPolicyTestObject::test<1>() template<> template<> void RetryPolicyTestObject::test<2>() { - LLAdaptiveRetryPolicy retry404(1.0,2.0,3.0,10); LLSD headers; F32 wait_seconds; - - retry404.onFailure(404,headers); - ensure("no retry on 404", !retry404.shouldRetry(wait_seconds)); + + // Normally only retry on server error (5xx) + LLAdaptiveRetryPolicy noRetry404(1.0,2.0,3.0,10); + noRetry404.onFailure(404,headers); + ensure("no retry on 404", !noRetry404.shouldRetry(wait_seconds)); + + // Can retry on 4xx errors if enabled by flag. + bool do_retry_4xx = true; + LLAdaptiveRetryPolicy doRetry404(1.0,2.0,3.0,10,do_retry_4xx); + doRetry404.onFailure(404,headers); + ensure("do retry on 404", doRetry404.shouldRetry(wait_seconds)); } template<> template<> |