summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-02-25 11:49:01 -0800
committerRider Linden <rider@lindenlab.com>2016-02-25 11:49:01 -0800
commit5093fe3da1f245817e51db5100070374bc278fe1 (patch)
treeb3b89ae71ca5d71538e7e0203a333fe31ec678fd /indra/newview/llappearancemgr.cpp
parent953b8ed694c2b5a2762e829e2ecf56fe07c23619 (diff)
MAINT-5693: Some bake requests were getting lost. If a bake request is made while another one is outstanding rather than launch the new one, set a flag and remake the request with new data.
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rwxr-xr-xindra/newview/llappearancemgr.cpp209
1 files changed, 121 insertions, 88 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index ec6154913b..ec0b7c9a8e 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -3354,123 +3354,154 @@ LLSD LLAppearanceMgr::dumpCOF() const
void LLAppearanceMgr::requestServerAppearanceUpdate()
{
- LLCoros::instance().launch("LLAppearanceMgr::serverAppearanceUpdateCoro",
- boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this));
-}
-
-void LLAppearanceMgr::serverAppearanceUpdateCoro()
-{
- // If we have already received an update for this or higher cof version, ignore.
- S32 cofVersion = getCOFVersion();
- S32 lastRcv = gAgentAvatarp->mLastUpdateReceivedCOFVersion;
- S32 lastReq = gAgentAvatarp->mLastUpdateRequestCOFVersion;
-
- //----------------
- // move out of coroutine
- if (!gAgent.getRegion())
+ if (!mIsServerBakeOutstanding)
{
- LL_WARNS("Avatar") << "Region not set, cannot request server appearance update" << LL_ENDL;
- return;
+ LLCoros::instance().launch("LLAppearanceMgr::serverAppearanceUpdateCoro",
+ boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this));
}
- if (gAgent.getRegion()->getCentralBakeVersion() == 0)
+ else
{
- LL_WARNS("Avatar") << "Region does not support baking" << LL_ENDL;
+ LL_WARNS("Avatar") << "Server bake request would overlap outstanding request " <<
+ " requesting new bake when ready." << LL_ENDL;
+ mNewServerBakeRequested = true;
}
+}
- std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance");
- if (url.empty())
- {
- LL_WARNS("Agent") << "Could not retrieve region capability \"UpdateAvatarAppearance\"" << LL_ENDL;
- }
+void LLAppearanceMgr::serverAppearanceUpdateCoro()
+{
+ BoolSetter inFlight(mIsServerBakeOutstanding);
- //----------------
- if (gAgentAvatarp->isEditingAppearance())
+ do
{
- LL_WARNS("Avatar") << "Avatar editing appearance, not sending request." << LL_ENDL;
- // don't send out appearance updates if in appearance editing mode
- return;
- }
-
- LL_DEBUGS("Avatar") << "COF version=" << cofVersion <<
- " last_rcv=" << lastRcv <<
- " last_req=" << lastReq << LL_ENDL;
+#if 0
+ static int reqcount = 0;
+ int r_count = ++reqcount;
+ LL_WARNS("Avatar") << "START: Server Bake request #" << r_count << "!" << LL_ENDL;
+#endif
- if (cofVersion < lastRcv)
- {
- LL_WARNS("Avatar") << "Have already received update for cof version " << lastRcv
- << " will not request for " << cofVersion << LL_ENDL;
- return;
- }
- if (lastReq >= cofVersion)
- {
- LL_WARNS("Avatar") << "Request already in flight for cof version " << lastReq
- << " will not request for " << cofVersion << LL_ENDL;
- return;
- }
+ // If we have already received an update for this or higher cof version, ignore.
+ S32 cofVersion = getCOFVersion();
+ S32 lastRcv = gAgentAvatarp->mLastUpdateReceivedCOFVersion;
+ S32 lastReq = gAgentAvatarp->mLastUpdateRequestCOFVersion;
- // Actually send the request.
- LL_DEBUGS("Avatar") << "Will send request for cof_version " << cofVersion << LL_ENDL;
+ mNewServerBakeRequested = false;
+ //----------------
+ // move out of coroutine
+ if (!gAgent.getRegion())
+ {
+ LL_WARNS("Avatar") << "Region not set, cannot request server appearance update" << LL_ENDL;
+ return;
+ }
+ if (gAgent.getRegion()->getCentralBakeVersion() == 0)
+ {
+ LL_WARNS("Avatar") << "Region does not support baking" << LL_ENDL;
+ }
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter(
- "UpdateAvatarAppearance", gAgent.getAgentPolicy()));
+ std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance");
+ if (url.empty())
+ {
+ LL_WARNS("Agent") << "Could not retrieve region capability \"UpdateAvatarAppearance\"" << LL_ENDL;
+ }
- S32 reqCofVersion = cofVersion;
- if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure"))
- {
- reqCofVersion += 999;
- LL_WARNS("Avatar") << "Forcing version failure on COF Baking" << LL_ENDL;
- }
+ //----------------
+ if (gAgentAvatarp->isEditingAppearance())
+ {
+ LL_WARNS("Avatar") << "Avatar editing appearance, not sending request." << LL_ENDL;
+ // don't send out appearance updates if in appearance editing mode
+ return;
+ }
- do
- {
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+ LL_DEBUGS("Avatar") << "COF version=" << cofVersion <<
+ " last_rcv=" << lastRcv <<
+ " last_req=" << lastReq << LL_ENDL;
- LLSD postData;
- if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate"))
+ if (cofVersion < lastRcv)
{
- postData = dumpCOF();
+ LL_WARNS("Avatar") << "Have already received update for cof version " << lastRcv
+ << " will not request for " << cofVersion << LL_ENDL;
+ return;
}
- else
+ if (lastReq >= cofVersion)
{
- postData["cof_version"] = reqCofVersion;
+ LL_WARNS("Avatar") << "Request already in flight for cof version " << lastReq
+ << " will not request for " << cofVersion << LL_ENDL;
+ return;
}
- gAgentAvatarp->mLastUpdateRequestCOFVersion = reqCofVersion;
+ // Actually send the request.
+ LL_DEBUGS("Avatar") << "Will send request for cof_version " << cofVersion << LL_ENDL;
- LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter(
+ "UpdateAvatarAppearance", gAgent.getAgentPolicy()));
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ S32 reqCofVersion = cofVersion;
+ if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure"))
+ {
+ reqCofVersion += 999;
+ LL_WARNS("Avatar") << "Forcing version failure on COF Baking" << LL_ENDL;
+ }
- if (!status || !result["success"].asBoolean())
+ do
{
- 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"))
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest());
+
+ LLSD postData;
+ if (gSavedSettings.getBOOL("DebugAvatarExperimentalServerAppearanceUpdate"))
{
- reqCofVersion = result["expected"].asInteger();
+ postData = dumpCOF();
+ }
+ else
+ {
+ postData["cof_version"] = reqCofVersion;
+ }
- LL_WARNS("Avatar") << "Will Retry with expected COF value of " << reqCofVersion << LL_ENDL;
- continue;
+ gAgentAvatarp->mLastUpdateRequestCOFVersion = reqCofVersion;
+
+ LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ 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"))
+ {
+ reqCofVersion = result["expected"].asInteger();
+
+ LL_WARNS("Avatar") << "Will Retry with expected COF value of " << reqCofVersion << LL_ENDL;
+ continue;
+ }
+
+ break;
+ }
+
+ LL_DEBUGS("Avatar") << "succeeded" << LL_ENDL;
+ if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+ {
+ dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", result);
}
break;
- }
+ } while (true);
- LL_DEBUGS("Avatar") << "succeeded" << LL_ENDL;
- if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+#if 0
+ LL_WARNS("Avatar") << "END: Server Bake request #" << r_count << "!" << LL_ENDL;
+#endif
+
+ // if someone requested a server bake before the previous one was finished
+ // repeate the process.
+ if (mNewServerBakeRequested)
{
- dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", result);
+ LL_WARNS("Avatar") << "New bake request received while processing previous one. Re-requesting." << LL_ENDL;
}
-
- break;
- } while (true);
-
+ } while (mNewServerBakeRequested);
}
/*static*/
@@ -3838,7 +3869,9 @@ LLAppearanceMgr::LLAppearanceMgr():
mOutfitLocked(false),
mInFlightCounter(0),
mInFlightTimer(),
- mIsInUpdateAppearanceFromCOF(false)
+ mIsInUpdateAppearanceFromCOF(false),
+ mIsServerBakeOutstanding(false),
+ mNewServerBakeRequested(false)
{
LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
// unlock outfit on save operation completed