diff options
author | Richard Linden <none@none> | 2013-02-27 11:19:17 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2013-02-27 11:19:17 -0800 |
commit | 83eda3f1524a08fa6fc4fbd836c92ae95e8100bc (patch) | |
tree | b7317c3ba90269fa0136e46f260223bd04210678 /indra/newview/llappearancemgr.cpp | |
parent | df3f6f6cacd3803748af569ad76ae1131ad1b1b9 (diff) | |
parent | 756ab4cad5908f30c29a9e86f6905745dbec616c (diff) |
Automated merge with https://bitbucket.org/lindenlab/sunshine-internal
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 81 |
1 files changed, 78 insertions, 3 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2e71f15a78..f56ae7caf1 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -211,7 +211,7 @@ public: void addItem(const LLUUID& item_id) { LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; - + if (!requestOperation(item_id)) { LL_DEBUGS("Avatar") << "item_id " << item_id << " requestOperation false, skipping" << llendl; @@ -1692,7 +1692,7 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin gInventory.purgeObject(item->getUUID()); } #else - gInventory.purgeObject(item->getUUID()); + gInventory.purgeObject(item->getUUID()); } #endif } @@ -3083,7 +3083,7 @@ public: { llwarns << "giving up after too many retries" << llendl; } - } + } void dumpContents(const std::string outprefix, const LLSD& content) { @@ -3148,6 +3148,81 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond mLastUpdateRequestCOFVersion = cof_version; } +class LLIncrementCofVersionResponder : public LLHTTPClient::Responder +{ +public: + LLIncrementCofVersionResponder() : LLHTTPClient::Responder() + { + mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 16.0, 2.0, 5); + } + + virtual ~LLIncrementCofVersionResponder() + { + } + + virtual void result(const LLSD &pContent) + { + llinfos << "Successfully incremented agent's COF." << llendl; + S32 new_version = pContent["category"]["version"].asInteger(); + + LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance(); + + // cof_version should have increased + llassert(new_version > app_mgr->mLastUpdateRequestCOFVersion); + + app_mgr->mLastUpdateRequestCOFVersion = new_version; + } + virtual void error(U32 pStatus, const std::string& pReason) + { + llwarns << "While attempting to increment the agent's cof we got an error because '" + << pReason << "' [status:" << pStatus << "]" << llendl; + F32 seconds_to_wait; + if (mRetryPolicy->shouldRetry(pStatus,seconds_to_wait)) + { + llinfos << "retrying" << llendl; + doAfterInterval(boost::bind(&LLAppearanceMgr::incrementCofVersion, + LLAppearanceMgr::getInstance(), + LLHTTPClient::ResponderPtr(this)), + seconds_to_wait); + } + else + { + llwarns << "giving up after too many retries" << llendl; + } + } + + LLPointer<LLHTTPRetryPolicy> mRetryPolicy; +}; + +void LLAppearanceMgr::incrementCofVersion(LLHTTPClient::ResponderPtr responder_ptr) +{ + // If we don't have a region, report it as an error + if (gAgent.getRegion() == NULL) + { + llwarns << "Region not set, cannot request cof_version increment" << llendl; + return; + } + + std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); + if (url.empty()) + { + llwarns << "No cap for IncrementCofVersion." << llendl; + return; + } + + llinfos << "Requesting cof_version be incremented via capability to: " + << url << llendl; + LLSD headers; + LLSD body = LLSD::emptyMap(); + + if (!responder_ptr.get()) + { + responder_ptr = LLHTTPClient::ResponderPtr(new LLIncrementCofVersionResponder()); + } + + LLHTTPClient::get(url, body, responder_ptr, headers, 30.0f); +} + void show_created_outfit(LLUUID& folder_id, bool show_panel = true) { if (!LLApp::isRunning()) |