diff options
author | Rider Linden <rider@lindenlab.com> | 2016-03-03 10:15:47 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2016-03-03 10:15:47 -0800 |
commit | 3b790524865dc7a61496ee8ba90520d8be7cadf1 (patch) | |
tree | dc3c8fdb4ac539d3a396be858ba848dab8c0e51f /indra | |
parent | a407cb784266802317fe299baa792166e3128293 (diff) |
MAINT-5693: Move avatar update into the AIS coprocedure pool.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 176 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.h | 5 |
2 files changed, 78 insertions, 103 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 76b7ea5ccc..a2ab32a09e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3354,23 +3354,12 @@ LLSD LLAppearanceMgr::dumpCOF() const void LLAppearanceMgr::requestServerAppearanceUpdate() { - if (!mIsServerBakeOutstanding) - { - LLCoros::instance().launch("LLAppearanceMgr::serverAppearanceUpdateCoro", - boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this)); - } - else - { - LL_WARNS("Avatar") << "Server bake request would overlap outstanding request " << - " requesting new bake when ready." << LL_ENDL; - mNewServerBakeRequested = true; - } + LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this, _1); + LLCoprocedureManager::instance().enqueueCoprocedure("AIS", "LLAppearanceMgr::serverAppearanceUpdateCoro", proc); } -void LLAppearanceMgr::serverAppearanceUpdateCoro() +void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter) { - BoolSetter inFlight(mIsServerBakeOutstanding); - if (!gAgent.getRegion()) { LL_WARNS("Avatar") << "Region not set, cannot request server appearance update" << LL_ENDL; @@ -3397,114 +3386,103 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro() return; } - do - { #if 0 - static int reqcount = 0; - int r_count = ++reqcount; - LL_WARNS("Avatar") << "START: Server Bake request #" << r_count << "!" << LL_ENDL; + static int reqcount = 0; + int r_count = ++reqcount; + LL_WARNS("Avatar") << "START: Server Bake request #" << r_count << "!" << LL_ENDL; #endif - // If we have already received an update for this or higher cof version, - // put a warning in the log but request anyway. - S32 cofVersion = getCOFVersion(); - S32 lastRcv = gAgentAvatarp->mLastUpdateReceivedCOFVersion; - S32 lastReq = gAgentAvatarp->mLastUpdateRequestCOFVersion; + // If we have already received an update for this or higher cof version, + // put a warning in the log but request anyway. + S32 cofVersion = getCOFVersion(); + S32 lastRcv = gAgentAvatarp->mLastUpdateReceivedCOFVersion; + S32 lastReq = gAgentAvatarp->mLastUpdateRequestCOFVersion; - mNewServerBakeRequested = false; + LL_INFOS("Avatar") << "Requesting COF version " << cofVersion << + " (Last Received:" << lastRcv << ")" << + " (Last Requested:" << lastReq << ")" << LL_ENDL; - LL_INFOS("Avatar") << "Requesting COF version " << cofVersion << - " (Last Received:" << lastRcv << ")" << - " (Last Requested:" << lastReq << ")" << LL_ENDL; + if ((cofVersion != LLViewerInventoryCategory::VERSION_UNKNOWN)) + { + if (cofVersion < lastRcv) + { + LL_WARNS("Avatar") << "Have already received update for cof version " << lastRcv + << " but requesting for " << cofVersion << LL_ENDL; + } + if (lastReq > cofVersion) + { + LL_WARNS("Avatar") << "Request already in flight for cof version " << lastReq + << " but requesting for " << cofVersion << LL_ENDL; + } + } - if ((cofVersion != LLViewerInventoryCategory::VERSION_UNKNOWN)) - { - if (cofVersion < lastRcv) - { - LL_WARNS("Avatar") << "Have already received update for cof version " << lastRcv - << " but requesting for " << cofVersion << LL_ENDL; - } - if (lastReq > cofVersion) - { - LL_WARNS("Avatar") << "Request already in flight for cof version " << lastReq - << " but requesting for " << cofVersion << LL_ENDL; - } - } + // Actually send the request. + LL_DEBUGS("Avatar") << "Will send request for cof_version " << cofVersion << LL_ENDL; + +// LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter( +// "UpdateAvatarAppearance", gAgent.getAgentPolicy())); - // Actually send the request. - LL_DEBUGS("Avatar") << "Will send request for cof_version " << cofVersion << LL_ENDL; + S32 reqCofVersion = cofVersion; + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + reqCofVersion += 999; + LL_WARNS("Avatar") << "Forcing version failure on COF Baking" << LL_ENDL; + } - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter( - "UpdateAvatarAppearance", gAgent.getAgentPolicy())); + do + { + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); - S32 reqCofVersion = cofVersion; - if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + LLSD postData; + if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate")) { - reqCofVersion += 999; - LL_WARNS("Avatar") << "Forcing version failure on COF Baking" << LL_ENDL; + postData = dumpCOF(); } - - do + else { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); - - LLSD postData; - if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate")) - { - postData = dumpCOF(); - } - else - { - postData["cof_version"] = reqCofVersion; - } + postData["cof_version"] = reqCofVersion; + } - gAgentAvatarp->mLastUpdateRequestCOFVersion = reqCofVersion; + gAgentAvatarp->mLastUpdateRequestCOFVersion = reqCofVersion; - LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - if (!status || !result["success"].asBoolean()) + if (!status || !result["success"].asBoolean()) + { + std::string message = (result.has("error")) ? result["error"].asString() : status.toString(); + LL_WARNS("Avatar") << "Appearance Failure. server responded with \"" << message << "\"" << LL_ENDL; + + // We may have requested a bake for a stale COF (especially if the inventory + // is still updating. If that is the case re send the request with the + // corrected COF version. (This may also be the case if the viewer is running + // on multiple machines. + if (result.has("expected")) { - std::string message = (result.has("error")) ? result["error"].asString() : status.toString(); - LL_WARNS("Avatar") << "Appearance Failure. server responded with \"" << message << "\"" << LL_ENDL; - - // We may have requested a bake for a stale COF (especially if the inventory - // is still updating. If that is the case re send the request with the - // corrected COF version. (This may also be the case if the viewer is running - // on multiple machines. - if (result.has("expected")) - { - reqCofVersion = result["expected"].asInteger(); - - LL_WARNS("Avatar") << "Will Retry with expected COF value of " << reqCofVersion << LL_ENDL; - continue; - } - - break; - } + reqCofVersion = result["expected"].asInteger(); - LL_DEBUGS("Avatar") << "succeeded" << LL_ENDL; - if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) - { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", result); + LL_WARNS("Avatar") << "Will Retry with expected COF value of " << reqCofVersion << LL_ENDL; + continue; } break; - } while (true); + } + + LL_DEBUGS("Avatar") << "succeeded" << LL_ENDL; + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", result); + } + + break; + } while (true); #if 0 - LL_WARNS("Avatar") << "END: Server Bake request #" << r_count << "!" << LL_ENDL; + LL_WARNS("Avatar") << "END: Server Bake request #" << r_count << "!" << LL_ENDL; #endif - // if someone requested a server bake before the previous one was finished - // repeat the process. - if (mNewServerBakeRequested) - { - LL_WARNS("Avatar") << "New bake request received while processing previous one. Re-requesting." << LL_ENDL; - } - } while (mNewServerBakeRequested); } /*static*/ @@ -3872,9 +3850,7 @@ LLAppearanceMgr::LLAppearanceMgr(): mOutfitLocked(false), mInFlightCounter(0), mInFlightTimer(), - mIsInUpdateAppearanceFromCOF(false), - mIsServerBakeOutstanding(false), - mNewServerBakeRequested(false) + mIsInUpdateAppearanceFromCOF(false) { LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); // unlock outfit on save operation completed diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index ebe564c3ea..b97f9018c0 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -34,6 +34,7 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llviewerinventory.h" +#include "llcorehttputil.h" class LLWearableHoldingPattern; class LLInventoryCallback; @@ -227,7 +228,7 @@ public: private: - void serverAppearanceUpdateCoro(); + void serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter); static void debugAppearanceUpdateCOF(const LLSD& content); std::string mAppearanceServiceURL; @@ -254,8 +255,6 @@ private: bool mAttachmentInvLinkEnabled; bool mOutfitIsDirty; bool mIsInUpdateAppearanceFromCOF; // to detect recursive calls. - bool mIsServerBakeOutstanding; // A server texture bake has been sent to the server and we are waiting on a response. - bool mNewServerBakeRequested; // A server texture bake has been requested, but there is already one outstanding. /** * Lock for blocking operations on outfit until server reply or timeout exceed |