From f6ba7514d2392bfb5bbbe8b003b4b860118fddc5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 26 Mar 2015 10:34:19 -0700 Subject: Fix line endings on appearancemgr and added LLCore::Http to llAgent. --- indra/newview/llagent.cpp | 156 +++++++++++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 64 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f151b15e29..ff0e2c42c1 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -95,6 +95,8 @@ #include "lscript_byteformat.h" #include "stringize.h" #include "boost/foreach.hpp" +#include "llhttpsdhandler.h" +#include "llcorehttputil.h" using namespace LLAvatarAppearanceDefines; @@ -323,6 +325,7 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) // For a toggled version, see viewer.h for the // TOGGLE_HACKED_GODLIKE_VIEWER define, instead. // ************************************************************ +bool LLAgent::mActive = true; // Constructors and Destructors @@ -361,7 +364,12 @@ LLAgent::LLAgent() : mMaturityPreferenceNumRetries(0U), mLastKnownRequestMaturity(SIM_ACCESS_MIN), mLastKnownResponseMaturity(SIM_ACCESS_MIN), - mTeleportState( TELEPORT_NONE ), + mHttpRequest(), + mHttpHeaders(), + mHttpOptions(), + mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), + mHttpPriority(0), + mTeleportState(TELEPORT_NONE), mRegionp(NULL), mAgentOriginGlobal(), @@ -459,6 +467,15 @@ void LLAgent::init() mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLAgent::handleTeleportFailed, this)); } + LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); + + mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); + mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false); + mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false); + mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AVATAR); + + doOnIdleRepeating(boost::bind(&LLAgent::onIdle, this)); + mInitialized = TRUE; } @@ -467,6 +484,7 @@ void LLAgent::init() //----------------------------------------------------------------------------- void LLAgent::cleanup() { + mActive = false; mRegionp = NULL; if (mTeleportFinishedSlot.connected()) { @@ -498,6 +516,17 @@ LLAgent::~LLAgent() mTeleportSourceSLURL = NULL; } +//----------------------------------------------------------------------------- +// Idle processing +//----------------------------------------------------------------------------- +bool LLAgent::onIdle() +{ + if (!LLAgent::mActive) + return true; + mHttpRequest->update(0L); + return false; +} + // Handle any actions that need to be performed when the main app gains focus // (such as through alt-tab). //----------------------------------------------------------------------------- @@ -2515,66 +2544,61 @@ int LLAgent::convertTextToMaturity(char text) return LLAgentAccess::convertTextToMaturity(text); } -class LLMaturityPreferencesResponder : public LLHTTPClient::Responder +//========================================================================= +class LLMaturityHttpHandler : public LLHttpSDHandler { - LOG_CLASS(LLMaturityPreferencesResponder); public: - LLMaturityPreferencesResponder(LLAgent *pAgent, U8 pPreferredMaturity, U8 pPreviousMaturity); - virtual ~LLMaturityPreferencesResponder(); + LLMaturityHttpHandler(const std::string& capabilityURL, LLAgent *agent, U8 preferred, U8 previous): + LLHttpSDHandler(capabilityURL), + mAgent(agent), + mPreferredMaturity(preferred), + mPreviousMaturity(previous) + { } -protected: - virtual void httpSuccess(); - virtual void httpFailure(); + virtual ~LLMaturityHttpHandler() + { } protected: + virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); + virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: - U8 parseMaturityFromServerResponse(const LLSD &pContent) const; - - LLAgent *mAgent; - U8 mPreferredMaturity; - U8 mPreviousMaturity; -}; + U8 LLMaturityHttpHandler::parseMaturityFromServerResponse(const LLSD &pContent) const; -LLMaturityPreferencesResponder::LLMaturityPreferencesResponder(LLAgent *pAgent, U8 pPreferredMaturity, U8 pPreviousMaturity) - : LLHTTPClient::Responder(), - mAgent(pAgent), - mPreferredMaturity(pPreferredMaturity), - mPreviousMaturity(pPreviousMaturity) -{ -} + LLAgent * mAgent; + U8 mPreferredMaturity; + U8 mPreviousMaturity; -LLMaturityPreferencesResponder::~LLMaturityPreferencesResponder() -{ -} +}; -void LLMaturityPreferencesResponder::httpSuccess() +//------------------------------------------------------------------------- +void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) { - U8 actualMaturity = parseMaturityFromServerResponse(getContent()); + U8 actualMaturity = parseMaturityFromServerResponse(content); if (actualMaturity != mPreferredMaturity) { LL_WARNS() << "while attempting to change maturity preference from '" - << LLViewerRegion::accessToString(mPreviousMaturity) - << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) - << "', the server responded with '" - << LLViewerRegion::accessToString(actualMaturity) - << "' [value:" << static_cast(actualMaturity) - << "], " << dumpResponse() << LL_ENDL; + << LLViewerRegion::accessToString(mPreviousMaturity) + << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) + << "', the server responded with '" + << LLViewerRegion::accessToString(actualMaturity) + << "' [value:" << static_cast(actualMaturity) + << "], " << LL_ENDL; } mAgent->handlePreferredMaturityResult(actualMaturity); } -void LLMaturityPreferencesResponder::httpFailure() +void LLMaturityHttpHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) { - LL_WARNS() << "while attempting to change maturity preference from '" - << LLViewerRegion::accessToString(mPreviousMaturity) - << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) - << "', " << dumpResponse() << LL_ENDL; + LL_WARNS() << "while attempting to change maturity preference from '" + << LLViewerRegion::accessToString(mPreviousMaturity) + << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) + << "', " << LL_ENDL; mAgent->handlePreferredMaturityError(); } -U8 LLMaturityPreferencesResponder::parseMaturityFromServerResponse(const LLSD &pContent) const +U8 LLMaturityHttpHandler::parseMaturityFromServerResponse(const LLSD &pContent) const { U8 maturity = SIM_ACCESS_MIN; @@ -2595,6 +2619,7 @@ U8 LLMaturityPreferencesResponder::parseMaturityFromServerResponse(const LLSD &p return maturity; } +//========================================================================= void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity) { @@ -2724,38 +2749,41 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) // Update the last know maturity request mLastKnownRequestMaturity = pPreferredMaturity; - // Create a response handler - LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLMaturityPreferencesResponder(this, pPreferredMaturity, mLastKnownResponseMaturity)); - // If we don't have a region, report it as an error if (getRegion() == NULL) { - responderPtr->failureResult(0U, "region is not defined", LLSD()); + LL_WARNS("Agent") << "Region is not defined, can not change Maturity setting." << LL_ENDL; + return; } - else + std::string url = getRegion()->getCapability("UpdateAgentInformation"); + + // If the capability is not defined, report it as an error + if (url.empty()) { - // Find the capability to send maturity preference - std::string url = getRegion()->getCapability("UpdateAgentInformation"); + LL_WARNS("Agent") << "'UpdateAgentInformation' is not defined for region" << LL_ENDL; + return; + } - // If the capability is not defined, report it as an error - if (url.empty()) - { - responderPtr->failureResult(0U, - "capability 'UpdateAgentInformation' is not defined for region", LLSD()); - } - else - { - // Set new access preference - LLSD access_prefs = LLSD::emptyMap(); - access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); - - LLSD body = LLSD::emptyMap(); - body["access_prefs"] = access_prefs; - LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) - << "' via capability to: " << url << LL_ENDL; - LLSD headers; - LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); - } + LLMaturityHttpHandler * handler = new LLMaturityHttpHandler(url, this, pPreferredMaturity, mLastKnownResponseMaturity); + + LLSD access_prefs = LLSD::emptyMap(); + access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); + + LLSD postData = LLSD::emptyMap(); + postData["access_prefs"] = access_prefs; + LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) + << "' via capability to: " << url << LL_ENDL; + + LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, + mHttpPolicy, mHttpPriority, url, + postData, mHttpOptions, mHttpHeaders, handler); + + if (handle == LLCORE_HTTP_HANDLE_INVALID) + { + delete handler; + LLCore::HttpStatus status = mHttpRequest->getStatus(); + LL_WARNS("Avatar") << "Maturity request post failed Reason " << status.toTerseString() + << " \"" << status.toString() << "\"" << LL_ENDL; } } } -- cgit v1.2.3 From 97b93179692b764aba7eee571f1b557f6f8070db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 26 Mar 2015 13:32:09 -0700 Subject: Create trivial handler for SD Messages, method in LLAgent for posting HTTP requests. --- indra/newview/llagent.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ff0e2c42c1..81387fb927 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -472,7 +472,7 @@ void LLAgent::init() mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false); mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false); - mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AVATAR); + mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT); doOnIdleRepeating(boost::bind(&LLAgent::onIdle, this)); @@ -2563,7 +2563,7 @@ protected: virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: - U8 LLMaturityHttpHandler::parseMaturityFromServerResponse(const LLSD &pContent) const; + U8 parseMaturityFromServerResponse(const LLSD &pContent) const; LLAgent * mAgent; U8 mPreferredMaturity; @@ -2774,20 +2774,39 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) << "' via capability to: " << url << LL_ENDL; - LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, - mHttpPolicy, mHttpPriority, url, - postData, mHttpOptions, mHttpHeaders, handler); + LLCore::HttpHandle handle = requestPostCapibility("UpdateAgentInformation", url, postData, handler); if (handle == LLCORE_HTTP_HANDLE_INVALID) { delete handler; - LLCore::HttpStatus status = mHttpRequest->getStatus(); - LL_WARNS("Avatar") << "Maturity request post failed Reason " << status.toTerseString() - << " \"" << status.toString() << "\"" << LL_ENDL; + LL_WARNS("Avatar") << "Maturity request post failed." << LL_ENDL; } } } +LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) +{ + LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(url, cap); + LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, + mHttpPolicy, mHttpPriority, url, + postData, mHttpOptions, mHttpHeaders, handler); + + if (handle == LLCORE_HTTP_HANDLE_INVALID) + { + if (!usrhndlr) + delete handler; + LLCore::HttpStatus status = mHttpRequest->getStatus(); + LL_WARNS("Avatar") << "'" << cap << "' request POST failed. Reason " + << status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL; + } + return handle; +} + +//LLCore::HttpHandle LLAgent::httpGetCapibility(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr) +//{ +//} + + BOOL LLAgent::getAdminOverride() const { return mAgentAccess->getAdminOverride(); -- cgit v1.2.3 From 735364038767694ea29d9b6a168410e6482cc9c2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 27 Mar 2015 17:00:02 -0700 Subject: first set of chnages from code review from Nat --- indra/newview/llagent.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 81387fb927..667d530e39 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2559,7 +2559,7 @@ public: { } protected: - virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); + virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: @@ -2572,7 +2572,7 @@ private: }; //------------------------------------------------------------------------- -void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content) { U8 actualMaturity = parseMaturityFromServerResponse(content); @@ -2774,7 +2774,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) << "' via capability to: " << url << LL_ENDL; - LLCore::HttpHandle handle = requestPostCapibility("UpdateAgentInformation", url, postData, handler); + LLCore::HttpHandle handle = requestPostCapability("UpdateAgentInformation", url, postData, handler); if (handle == LLCORE_HTTP_HANDLE_INVALID) { @@ -2784,7 +2784,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) } } -LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) +LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) { LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(url, cap); LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, @@ -2793,6 +2793,9 @@ LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const if (handle == LLCORE_HTTP_HANDLE_INVALID) { + // If no handler was passed in we delete the handler default handler allocated + // at the start of this function. + // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers. Requires change in LLCore::HTTP if (!usrhndlr) delete handler; LLCore::HttpStatus status = mHttpRequest->getStatus(); -- cgit v1.2.3 From edc1439bd633bdac183fbecc131edd55074b5442 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 1 Apr 2015 16:37:00 -0700 Subject: Added AvatarNameCache as coroutine, with LLCore::HttpHandler to respond correctly to Event Pumps. Added get/setRequestURL() to LLCore::HttpResponse Removed URI from the HttpSDHandler. --- indra/newview/llagent.cpp | 55 +++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 18 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 667d530e39..eeedda5c6d 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -325,7 +325,6 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) // For a toggled version, see viewer.h for the // TOGGLE_HACKED_GODLIKE_VIEWER define, instead. // ************************************************************ -bool LLAgent::mActive = true; // Constructors and Destructors @@ -474,7 +473,9 @@ void LLAgent::init() mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false); mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT); - doOnIdleRepeating(boost::bind(&LLAgent::onIdle, this)); + // Now ensure that we get regular callbacks to poll for completion. + mBoundListener = LLEventPumps::instance().obtain("mainloop"). + listen(LLEventPump::inventName(), boost::bind(&LLAgent::pollHttp, this, _1)); mInitialized = TRUE; } @@ -484,7 +485,6 @@ void LLAgent::init() //----------------------------------------------------------------------------- void LLAgent::cleanup() { - mActive = false; mRegionp = NULL; if (mTeleportFinishedSlot.connected()) { @@ -494,6 +494,10 @@ void LLAgent::cleanup() { mTeleportFailedSlot.disconnect(); } + if (mBoundListener.connected()) + { + mBoundListener.disconnect(); + } } //----------------------------------------------------------------------------- @@ -517,16 +521,16 @@ LLAgent::~LLAgent() } //----------------------------------------------------------------------------- -// Idle processing +// pollHttp +// Polling done once per frame on the "mainloop" to support HTTP processing. //----------------------------------------------------------------------------- -bool LLAgent::onIdle() +bool LLAgent::pollHttp(const LLSD&) { - if (!LLAgent::mActive) - return true; - mHttpRequest->update(0L); - return false; + mHttpRequest->update(0L); + return false; } + // Handle any actions that need to be performed when the main app gains focus // (such as through alt-tab). //----------------------------------------------------------------------------- @@ -2548,8 +2552,8 @@ int LLAgent::convertTextToMaturity(char text) class LLMaturityHttpHandler : public LLHttpSDHandler { public: - LLMaturityHttpHandler(const std::string& capabilityURL, LLAgent *agent, U8 preferred, U8 previous): - LLHttpSDHandler(capabilityURL), + LLMaturityHttpHandler(LLAgent *agent, U8 preferred, U8 previous): + LLHttpSDHandler(), mAgent(agent), mPreferredMaturity(preferred), mPreviousMaturity(previous) @@ -2764,7 +2768,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) return; } - LLMaturityHttpHandler * handler = new LLMaturityHttpHandler(url, this, pPreferredMaturity, mLastKnownResponseMaturity); + LLMaturityHttpHandler * handler = new LLMaturityHttpHandler(this, pPreferredMaturity, mLastKnownResponseMaturity); LLSD access_prefs = LLSD::emptyMap(); access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); @@ -2779,14 +2783,14 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) if (handle == LLCORE_HTTP_HANDLE_INVALID) { delete handler; - LL_WARNS("Avatar") << "Maturity request post failed." << LL_ENDL; + LL_WARNS("Agent") << "Maturity request post failed." << LL_ENDL; } } } LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) { - LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(url, cap); + LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(cap); LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, mHttpPolicy, mHttpPriority, url, postData, mHttpOptions, mHttpHeaders, handler); @@ -2799,16 +2803,31 @@ LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const if (!usrhndlr) delete handler; LLCore::HttpStatus status = mHttpRequest->getStatus(); - LL_WARNS("Avatar") << "'" << cap << "' request POST failed. Reason " + LL_WARNS("Agent") << "'" << cap << "' request POST failed. Reason " << status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL; } return handle; } -//LLCore::HttpHandle LLAgent::httpGetCapibility(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr) -//{ -//} +LLCore::HttpHandle LLAgent::requestGetCapability(const std::string &cap, const std::string &url, LLHttpSDHandler *usrhndlr) +{ + LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(cap); + LLCore::HttpHandle handle = mHttpRequest->requestGet(mHttpPolicy, mHttpPriority, + url, mHttpOptions.get(), mHttpHeaders.get(), handler); + if (handle == LLCORE_HTTP_HANDLE_INVALID) + { + // If no handler was passed in we delete the handler default handler allocated + // at the start of this function. + // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers. Requires change in LLCore::HTTP + if (!usrhndlr) + delete handler; + LLCore::HttpStatus status = mHttpRequest->getStatus(); + LL_WARNS("Agent") << "'" << cap << "' request GET failed. Reason " + << status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL; + } + return handle; +} BOOL LLAgent::getAdminOverride() const { -- cgit v1.2.3 From 176d8cd268611e28c07a462df3027f4872456e5a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 15 Apr 2015 11:51:48 -0700 Subject: Region caps and sim features converted to coroutine. --- indra/newview/llagent.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index eeedda5c6d..7f38e4b79f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2788,6 +2788,8 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) } } +// *TODO:RIDER Convert this system to using the coroutine scheme for HTTP communications +// LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) { LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(cap); -- cgit v1.2.3 From cf4fec954ca46a139465144ccc3888b8fc7d41da Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 8 Jun 2015 17:29:01 -0700 Subject: Added a way to pass a policy Id to the coroadapter. Changed language, appearance, and maturity to conform to use the adapter rather than the SDHandler --- indra/newview/llagent.cpp | 193 +++++++++++++++------------------------------- 1 file changed, 64 insertions(+), 129 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b983a636b6..df304d66c3 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2550,83 +2550,6 @@ int LLAgent::convertTextToMaturity(char text) return LLAgentAccess::convertTextToMaturity(text); } -//========================================================================= -class LLMaturityHttpHandler : public LLHttpSDHandler -{ -public: - LLMaturityHttpHandler(LLAgent *agent, U8 preferred, U8 previous): - LLHttpSDHandler(), - mAgent(agent), - mPreferredMaturity(preferred), - mPreviousMaturity(previous) - { } - - virtual ~LLMaturityHttpHandler() - { } - -protected: - virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); - virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); - -private: - U8 parseMaturityFromServerResponse(const LLSD &pContent) const; - - LLAgent * mAgent; - U8 mPreferredMaturity; - U8 mPreviousMaturity; - -}; - -//------------------------------------------------------------------------- -void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content) -{ - U8 actualMaturity = parseMaturityFromServerResponse(content); - - if (actualMaturity != mPreferredMaturity) - { - LL_WARNS() << "while attempting to change maturity preference from '" - << LLViewerRegion::accessToString(mPreviousMaturity) - << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) - << "', the server responded with '" - << LLViewerRegion::accessToString(actualMaturity) - << "' [value:" << static_cast(actualMaturity) - << "], " << LL_ENDL; - } - mAgent->handlePreferredMaturityResult(actualMaturity); -} - -void LLMaturityHttpHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) -{ - LL_WARNS() << "while attempting to change maturity preference from '" - << LLViewerRegion::accessToString(mPreviousMaturity) - << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) - << "', " << LL_ENDL; - mAgent->handlePreferredMaturityError(); -} - -U8 LLMaturityHttpHandler::parseMaturityFromServerResponse(const LLSD &pContent) const -{ - U8 maturity = SIM_ACCESS_MIN; - - llassert(pContent.isDefined()); - llassert(pContent.isMap()); - llassert(pContent.has("access_prefs")); - llassert(pContent.get("access_prefs").isMap()); - llassert(pContent.get("access_prefs").has("max")); - llassert(pContent.get("access_prefs").get("max").isString()); - if (pContent.isDefined() && pContent.isMap() && pContent.has("access_prefs") - && pContent.get("access_prefs").isMap() && pContent.get("access_prefs").has("max") - && pContent.get("access_prefs").get("max").isString()) - { - LLSD::String actualPreference = pContent.get("access_prefs").get("max").asString(); - LLStringUtil::trim(actualPreference); - maturity = LLViewerRegion::shortStringToAccess(actualPreference); - } - - return maturity; -} -//========================================================================= - void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity) { // Update the number of responses received @@ -2761,76 +2684,88 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) LL_WARNS("Agent") << "Region is not defined, can not change Maturity setting." << LL_ENDL; return; } - std::string url = getRegion()->getCapability("UpdateAgentInformation"); - - // If the capability is not defined, report it as an error - if (url.empty()) - { - LL_WARNS("Agent") << "'UpdateAgentInformation' is not defined for region" << LL_ENDL; - return; - } - - LLMaturityHttpHandler * handler = new LLMaturityHttpHandler(this, pPreferredMaturity, mLastKnownResponseMaturity); LLSD access_prefs = LLSD::emptyMap(); access_prefs["max"] = LLViewerRegion::accessToShortString(pPreferredMaturity); LLSD postData = LLSD::emptyMap(); postData["access_prefs"] = access_prefs; - LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) - << "' via capability to: " << url << LL_ENDL; - - LLCore::HttpHandle handle = requestPostCapability("UpdateAgentInformation", url, postData, handler); + LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) << LL_ENDL; - if (handle == LLCORE_HTTP_HANDLE_INVALID) - { - delete handler; - LL_WARNS("Agent") << "Maturity request post failed." << LL_ENDL; - } + if (!requestPostCapability("UpdateAgentInformation", postData, + static_cast(boost::bind(&LLAgent::processMaturityPreferenceFromServer, this, _1, pPreferredMaturity)), + static_cast(boost::bind(&LLAgent::handlePreferredMaturityError, this)) + )) + { + LL_WARNS("Agent") << "Maturity request post failed." << LL_ENDL; + } } } -// *TODO:RIDER Convert this system to using the coroutine scheme for HTTP communications -// -LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) + +void LLAgent::processMaturityPreferenceFromServer(const LLSD &result, U8 perferredMaturity) { - LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(cap); - LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, - mHttpPolicy, mHttpPriority, url, - postData, mHttpOptions, mHttpHeaders, handler); + U8 maturity = SIM_ACCESS_MIN; - if (handle == LLCORE_HTTP_HANDLE_INVALID) - { - // If no handler was passed in we delete the handler default handler allocated - // at the start of this function. - // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers. Requires change in LLCore::HTTP - if (!usrhndlr) - delete handler; - LLCore::HttpStatus status = mHttpRequest->getStatus(); - LL_WARNS("Agent") << "'" << cap << "' request POST failed. Reason " - << status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL; - } - return handle; + llassert(result.isDefined()); + llassert(result.isMap()); + llassert(result.has("access_prefs")); + llassert(result.get("access_prefs").isMap()); + llassert(result.get("access_prefs").has("max")); + llassert(result.get("access_prefs").get("max").isString()); + if (result.isDefined() && result.isMap() && result.has("access_prefs") + && result.get("access_prefs").isMap() && result.get("access_prefs").has("max") + && result.get("access_prefs").get("max").isString()) + { + LLSD::String actualPreference = result.get("access_prefs").get("max").asString(); + LLStringUtil::trim(actualPreference); + maturity = LLViewerRegion::shortStringToAccess(actualPreference); + } + + if (maturity != perferredMaturity) + { + LL_WARNS() << "while attempting to change maturity preference from '" + << LLViewerRegion::accessToString(mLastKnownResponseMaturity) + << "' to '" << LLViewerRegion::accessToString(perferredMaturity) + << "', the server responded with '" + << LLViewerRegion::accessToString(maturity) + << "' [value:" << static_cast(maturity) + << "], " << LL_ENDL; + } + handlePreferredMaturityResult(maturity); } -LLCore::HttpHandle LLAgent::requestGetCapability(const std::string &cap, const std::string &url, LLHttpSDHandler *usrhndlr) + +bool LLAgent::requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess, httpCallback_t cbFailure) { - LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(cap); - LLCore::HttpHandle handle = mHttpRequest->requestGet(mHttpPolicy, mHttpPriority, - url, mHttpOptions.get(), mHttpHeaders.get(), handler); + std::string url; + + url = getRegion()->getCapability(capName); - if (handle == LLCORE_HTTP_HANDLE_INVALID) + if (url.empty()) { - // If no handler was passed in we delete the handler default handler allocated - // at the start of this function. - // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers. Requires change in LLCore::HTTP - if (!usrhndlr) - delete handler; - LLCore::HttpStatus status = mHttpRequest->getStatus(); - LL_WARNS("Agent") << "'" << cap << "' request GET failed. Reason " - << status.toTerseString() << " \"" << status.toString() << "\"" << LL_ENDL; + LL_WARNS("Agent") << "Could not retrieve region capability \"" << capName << "\"" << LL_ENDL; + return false; } - return handle; + + LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(url, mHttpPolicy, postData, cbSuccess, cbFailure); + return true; +} + +bool LLAgent::requestGetCapability(const std::string &capName, httpCallback_t cbSuccess, httpCallback_t cbFailure) +{ + std::string url; + + url = getRegion()->getCapability(capName); + + if (url.empty()) + { + LL_WARNS("Agent") << "Could not retrieve region capability \"" << capName << "\"" << LL_ENDL; + return false; + } + + LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(url, mHttpPolicy, cbSuccess, cbFailure); + return true; } BOOL LLAgent::getAdminOverride() const -- cgit v1.2.3 From aba8d5e488d771f3d30ee75f0fbca30747adb7d1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 9 Jun 2015 13:06:09 -0700 Subject: Removed homelocation responder (rolled into llagent) Removed sdhandler from llagent. Removed unused values from llacountingccostmgr Fixed smart pontier creation in llfacebook --- indra/newview/llagent.cpp | 100 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 49 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index df304d66c3..230447b256 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -52,7 +52,6 @@ #include "llfloatertools.h" #include "llgroupactions.h" #include "llgroupmgr.h" -#include "llhomelocationresponder.h" #include "llhudmanager.h" #include "lljoystickbutton.h" #include "llmorphview.h" @@ -95,7 +94,6 @@ #include "lscript_byteformat.h" #include "stringize.h" #include "boost/foreach.hpp" -#include "llhttpsdhandler.h" #include "llcorehttputil.h" using namespace LLAvatarAppearanceDefines; @@ -363,11 +361,7 @@ LLAgent::LLAgent() : mMaturityPreferenceNumRetries(0U), mLastKnownRequestMaturity(SIM_ACCESS_MIN), mLastKnownResponseMaturity(SIM_ACCESS_MIN), - mHttpRequest(), - mHttpHeaders(), - mHttpOptions(), mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), - mHttpPriority(0), mTeleportState(TELEPORT_NONE), mRegionp(NULL), @@ -470,15 +464,8 @@ void LLAgent::init() LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); - mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false); - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false); mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT); - // Now ensure that we get regular callbacks to poll for completion. - mBoundListener = LLEventPumps::instance().obtain("mainloop"). - listen(LLEventPump::inventName(), boost::bind(&LLAgent::pollHttp, this, _1)); - mInitialized = TRUE; } @@ -496,10 +483,6 @@ void LLAgent::cleanup() { mTeleportFailedSlot.disconnect(); } - if (mBoundListener.connected()) - { - mBoundListener.disconnect(); - } } //----------------------------------------------------------------------------- @@ -522,17 +505,6 @@ LLAgent::~LLAgent() mTeleportSourceSLURL = NULL; } -//----------------------------------------------------------------------------- -// pollHttp -// Polling done once per frame on the "mainloop" to support HTTP processing. -//----------------------------------------------------------------------------- -bool LLAgent::pollHttp(const LLSD&) -{ - mHttpRequest->update(0L); - return false; -} - - // Handle any actions that need to be performed when the main app gains focus // (such as through alt-tab). //----------------------------------------------------------------------------- @@ -2359,27 +2331,9 @@ void LLAgent::setStartPosition( U32 location_id ) body["HomeLocation"] = homeLocation; - // This awkward idiom warrants explanation. - // For starters, LLSDMessage::ResponderAdapter is ONLY for testing the new - // LLSDMessage functionality with a pre-existing LLHTTPClient::Responder. - // In new code, define your reply/error methods on the same class as the - // sending method, bind them to local LLEventPump objects and pass those - // LLEventPump names in the request LLSD object. - // When testing old code, the new LLHomeLocationResponder object - // is referenced by an LLHTTPClient::ResponderPtr, so when the - // ResponderAdapter is deleted, the LLHomeLocationResponder will be too. - // We must trust that the underlying LLHTTPClient code will eventually - // fire either the reply callback or the error callback; either will cause - // the ResponderAdapter to delete itself. - LLSDMessage::ResponderAdapter* - adapter(new LLSDMessage::ResponderAdapter(new LLHomeLocationResponder())); - - request["message"] = "HomeLocation"; - request["payload"] = body; - request["reply"] = adapter->getReplyName(); - request["error"] = adapter->getErrorName(); - - gAgent.getRegion()->getCapAPI().post(request); + if (!requestPostCapability("HomeLocation", body, + boost::bind(&LLAgent::setStartPositionSuccess, this, _1))) + LL_WARNS() << "Unable to post to HomeLocation capability." << LL_ENDL; const U32 HOME_INDEX = 1; if( HOME_INDEX == location_id ) @@ -2388,6 +2342,53 @@ void LLAgent::setStartPosition( U32 location_id ) } } +void LLAgent::setStartPositionSuccess(const LLSD &result) +{ + LLVector3 agent_pos; + bool error = true; + + do { + // was the call to /agent//home-location successful? + // If not, we keep error set to true + if (!result.has("success")) + break; + + if (0 != strncmp("true", result["success"].asString().c_str(), 4)) + break; + + // did the simulator return a "justified" home location? + // If no, we keep error set to true + if (!result.has("HomeLocation")) + break; + + if ((!result["HomeLocation"].has("LocationPos")) || + (!result["HomeLocation"]["LocationPos"].has("X")) || + (!result["HomeLocation"]["LocationPos"].has("Y")) || + (!result["HomeLocation"]["LocationPos"].has("Z"))) + break; + + agent_pos.mV[VX] = result["HomeLocation"]["LocationPos"]["X"].asInteger(); + agent_pos.mV[VY] = result["HomeLocation"]["LocationPos"]["Y"].asInteger(); + agent_pos.mV[VZ] = result["HomeLocation"]["LocationPos"]["Z"].asInteger(); + + error = false; + + } while (0); + + if (error) + { + LL_WARNS() << "Error in response to home position set." << LL_ENDL; + } + else + { + LL_INFOS() << "setting home position" << LL_ENDL; + + LLViewerRegion *viewer_region = gAgent.getRegion(); + setHomePosRegion(viewer_region->getHandle(), agent_pos); + } +} + +#if 1 struct HomeLocationMapper: public LLCapabilityListener::CapabilityMapper { // No reply message expected @@ -2414,6 +2415,7 @@ struct HomeLocationMapper: public LLCapabilityListener::CapabilityMapper }; // Need an instance of this class so it will self-register static HomeLocationMapper homeLocationMapper; +#endif void LLAgent::requestStopMotion( LLMotion* motion ) { -- cgit v1.2.3 From be1fa962dffd9601d65b480ddd2bb09c70ad5f89 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 9 Jun 2015 15:36:10 -0700 Subject: Removed dead code, llsdmessage, llcapabilitylistener and the associated tests. --- indra/newview/llagent.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 230447b256..2060065c75 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -38,7 +38,6 @@ #include "llappearancemgr.h" #include "llanimationstates.h" #include "llcallingcard.h" -#include "llcapabilitylistener.h" #include "llchannelmanager.h" #include "llchicletbar.h" #include "llconsole.h" @@ -62,7 +61,6 @@ #include "llpaneltopinfobar.h" #include "llparcel.h" #include "llrendersphere.h" -#include "llsdmessage.h" #include "llsdutil.h" #include "llsky.h" #include "llslurl.h" @@ -2388,35 +2386,6 @@ void LLAgent::setStartPositionSuccess(const LLSD &result) } } -#if 1 -struct HomeLocationMapper: public LLCapabilityListener::CapabilityMapper -{ - // No reply message expected - HomeLocationMapper(): LLCapabilityListener::CapabilityMapper("HomeLocation") {} - virtual void buildMessage(LLMessageSystem* msg, - const LLUUID& agentID, - const LLUUID& sessionID, - const std::string& capabilityName, - const LLSD& payload) const - { - msg->newMessageFast(_PREHASH_SetStartLocationRequest); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, agentID); - msg->addUUIDFast(_PREHASH_SessionID, sessionID); - msg->nextBlockFast( _PREHASH_StartLocationData); - // corrected by sim - msg->addStringFast(_PREHASH_SimName, ""); - msg->addU32Fast(_PREHASH_LocationID, payload["HomeLocation"]["LocationId"].asInteger()); - msg->addVector3Fast(_PREHASH_LocationPos, - ll_vector3_from_sdmap(payload["HomeLocation"]["LocationPos"])); - msg->addVector3Fast(_PREHASH_LocationLookAt, - ll_vector3_from_sdmap(payload["HomeLocation"]["LocationLookAt"])); - } -}; -// Need an instance of this class so it will self-register -static HomeLocationMapper homeLocationMapper; -#endif - void LLAgent::requestStopMotion( LLMotion* motion ) { // Notify all avatars that a motion has stopped. -- cgit v1.2.3 From 62527e6f18f0a035a234cf584e31f7eea93fd4a7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 18 Aug 2015 17:05:29 -0400 Subject: MAINT-5506: Fix ugly timing bug in llurlentry static initialization. The problem was that class-static LLUrlEntryParcel::sRegionHost was being initialized by copying class-static LLHost::invalid. Naturally, these two statics are initialized in different source files. Since C++ makes no promises about the relative order in which objects in different object files are initialized, it seems we hit a case in which we were trying to initialize sRegionHost by copying a completely uninitialized LLHost::invalid. In general we might attempt to address such cross-translation-unit issues by introducing an LLSingleton. But in this particular case, the punch line is that LLHost::invalid is explicitly constructed identically to a default-constructed LLHost! In other words, LLHost::invalid provides nothing we couldn't get from LLHost(). All it gives us is an opportunity for glitches such as the above. Remove LLHost::invalid and all references, replacing with LLHost(). --- indra/newview/llagent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7147769c43..e7dd378edd 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -930,7 +930,7 @@ LLHost LLAgent::getRegionHost() const } else { - return LLHost::invalid; + return LLHost(); } } -- cgit v1.2.3 From 96e343b49b0b5a0951ffab0beb2e1d09c37bbdc5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 1 Sep 2015 16:13:52 -0700 Subject: MAINT-5575: Convert the Experience cache into a coro based singleton. --HG-- branch : MAINT-5575 --- indra/newview/llagent.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e7dd378edd..3316f1e654 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -953,6 +953,15 @@ BOOL LLAgent::inPrelude() } +std::string LLAgent::getRegionCapability(const std::string &name) +{ + if (!mRegionp) + return std::string(); + + return mRegionp->getCapability(name); +} + + //----------------------------------------------------------------------------- // canManageEstate() //----------------------------------------------------------------------------- -- cgit v1.2.3 From 4676db63b2c38bec92fc5078b08a7c4b3d381fce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 17 Nov 2015 15:35:49 -0800 Subject: MAINT-5804: Additional logging in attempt to trap teleport disconnect. MAINT-5831: Discard late teleport initiation for teleport sequence that has already failed. --- indra/newview/llagent.cpp | 48 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e33d34ebc7..7f238a9a3b 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3690,6 +3690,7 @@ void LLAgent::clearVisualParams(void *data) // protected bool LLAgent::teleportCore(bool is_local) { + LL_INFOS("Teleport") << "In teleport core!" << LL_ENDL; if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING)) { LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL; @@ -3783,6 +3784,7 @@ bool LLAgent::hasRestartableFailedTeleportRequest() void LLAgent::restartFailedTeleportRequest() { + LL_INFOS("Teleport") << "Agent wishes to restart failed teleport." << LL_ENDL; if (hasRestartableFailedTeleportRequest()) { mTeleportRequest->setStatus(LLTeleportRequest::kRestartPending); @@ -3814,6 +3816,7 @@ bool LLAgent::hasPendingTeleportRequest() void LLAgent::startTeleportRequest() { + LL_INFOS("Telport") << "Agent handling start teleport request." << LL_ENDL; if(LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->setHidden(TRUE); @@ -3848,6 +3851,7 @@ void LLAgent::startTeleportRequest() void LLAgent::handleTeleportFinished() { + LL_INFOS("Teleport") << "Agent handling teleport finished." << LL_ENDL; clearTeleportRequest(); if (mIsMaturityRatingChangingDuringTeleport) { @@ -3869,12 +3873,18 @@ void LLAgent::handleTeleportFinished() void LLAgent::handleTeleportFailed() { + LL_WARNS("Teleport") << "Agent handling teleport failure!" << LL_ENDL; if(LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->setHidden(FALSE); } - if (mTeleportRequest != NULL) + setTeleportState(LLAgent::TELEPORT_NONE); + // Unlock the UI if the progress bar has been shown. +// gViewerWindow->setShowProgress(FALSE); +// gTeleportDisplay = FALSE; + + if (mTeleportRequest) { mTeleportRequest->setStatus(LLTeleportRequest::kFailed); } @@ -4076,6 +4086,13 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) void LLAgent::setTeleportState(ETeleportState state) { + if (mTeleportRequest && (state != TELEPORT_NONE) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) + { // A late message has come in regarding a failed teleport. + // We have already decided that it failed so should not reinitiate the teleport sequence in the viewer. + LL_WARNS("Teleport") << "Attempt to set teleport state to " << state << + " for previously failed teleport. Ignore!" << LL_ENDL; + return; + } mTeleportState = state; if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime")) { @@ -4422,24 +4439,29 @@ LLTeleportRequestViaLandmark::LLTeleportRequestViaLandmark(const LLUUID &pLandma : LLTeleportRequest(), mLandmarkId(pLandmarkId) { + LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark created." << LL_ENDL; } LLTeleportRequestViaLandmark::~LLTeleportRequestViaLandmark() { + LL_INFOS("Teleport") << "~LLTeleportRequestViaLandmark" << LL_ENDL; } bool LLTeleportRequestViaLandmark::canRestartTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::canRestartTeleport? -> true" << LL_ENDL; return true; } void LLTeleportRequestViaLandmark::startTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::startTeleport" << LL_ENDL; gAgent.doTeleportViaLandmark(getLandmarkId()); } void LLTeleportRequestViaLandmark::restartTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::restartTeleport" << LL_ENDL; gAgent.doTeleportViaLandmark(getLandmarkId()); } @@ -4451,10 +4473,12 @@ LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL p : LLTeleportRequestViaLandmark(pLureId), mIsLureGodLike(pIsLureGodLike) { + LL_INFOS("Teleport") << "LLTeleportRequestViaLure created" << LL_ENDL; } LLTeleportRequestViaLure::~LLTeleportRequestViaLure() { + LL_INFOS("Teleport") << "~LLTeleportRequestViaLure" << LL_ENDL; } bool LLTeleportRequestViaLure::canRestartTeleport() @@ -4471,11 +4495,13 @@ bool LLTeleportRequestViaLure::canRestartTeleport() // 8. User B's viewer then attempts to teleport via lure again // 9. This request will time-out on the viewer-side because User A's initial request has been removed from the "queue" in step 4 - return false; + LL_INFOS("Teleport") << "LLTeleportRequestViaLure::canRestartTeleport? -> false" << LL_ENDL; + return false; } void LLTeleportRequestViaLure::startTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLure::startTeleport" << LL_ENDL; gAgent.doTeleportViaLure(getLandmarkId(), isLureGodLike()); } @@ -4487,25 +4513,30 @@ LLTeleportRequestViaLocation::LLTeleportRequestViaLocation(const LLVector3d &pPo : LLTeleportRequest(), mPosGlobal(pPosGlobal) { + LL_INFOS("Teleport") << "LLTeleportRequestViaLocation created" << LL_ENDL; } LLTeleportRequestViaLocation::~LLTeleportRequestViaLocation() { + LL_INFOS("Teleport") << "~LLTeleportRequestViaLocation" << LL_ENDL; } bool LLTeleportRequestViaLocation::canRestartTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::canRestartTeleport -> true" << LL_ENDL; return true; } void LLTeleportRequestViaLocation::startTeleport() { + LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::startTeleport" << LL_ENDL; gAgent.doTeleportViaLocation(getPosGlobal()); } void LLTeleportRequestViaLocation::restartTeleport() { - gAgent.doTeleportViaLocation(getPosGlobal()); + LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::restartTeleport" << LL_ENDL; + gAgent.doTeleportViaLocation(getPosGlobal()); } //----------------------------------------------------------------------------- @@ -4515,25 +4546,30 @@ void LLTeleportRequestViaLocation::restartTeleport() LLTeleportRequestViaLocationLookAt::LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal) : LLTeleportRequestViaLocation(pPosGlobal) { + LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt created" << LL_ENDL; } LLTeleportRequestViaLocationLookAt::~LLTeleportRequestViaLocationLookAt() { + LL_INFOS("Teleport") << "~LLTeleportRequestViaLocationLookAt" << LL_ENDL; } bool LLTeleportRequestViaLocationLookAt::canRestartTeleport() { - return true; + LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt::canRestartTeleport -> true" << LL_ENDL; + return true; } void LLTeleportRequestViaLocationLookAt::startTeleport() { - gAgent.doTeleportViaLocationLookAt(getPosGlobal()); + LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt::startTeleport" << LL_ENDL; + gAgent.doTeleportViaLocationLookAt(getPosGlobal()); } void LLTeleportRequestViaLocationLookAt::restartTeleport() { - gAgent.doTeleportViaLocationLookAt(getPosGlobal()); + LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt::restartTeleport" << LL_ENDL; + gAgent.doTeleportViaLocationLookAt(getPosGlobal()); } // EOF -- cgit v1.2.3 From 40b085dfece81e155f336f39cb1d5bd7e3154991 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 20 Nov 2015 10:24:16 -0800 Subject: MAINT-5831: If there is a teleport request active and it has failed, teleport state will always return "None". --- indra/newview/llagent.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7f238a9a3b..157eb7d662 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4084,6 +4084,13 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt()); } +LLAgent::ETeleportState LLAgent::getTeleportState() const +{ + return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ? + TELEPORT_NONE : mTeleportState; +} + + void LLAgent::setTeleportState(ETeleportState state) { if (mTeleportRequest && (state != TELEPORT_NONE) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) -- cgit v1.2.3