summaryrefslogtreecommitdiff
path: root/indra/newview/llwlhandlers.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-04-12 22:07:59 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-04-12 22:07:59 +0300
commit19f356202a9516664c1cacb9b50e9b6e1e072375 (patch)
tree2e3099569987ce4e0b7fd140628776cccd4b5333 /indra/newview/llwlhandlers.cpp
parentfd18b0cd7e5d6b047ac482a9ba4926470f573fbf (diff)
STORM-1143 FIXED Server sometimes said region wasn't capable of storing environment settings.
Reason: We tried to check whether the region supports environment settings without making sure that we've actually recieved region capabilities, so the check sometimes failed. Fix: Defer check for the "EnvironmentSettings" capability until we've received the region capabilities.
Diffstat (limited to 'indra/newview/llwlhandlers.cpp')
-rw-r--r--indra/newview/llwlhandlers.cpp52
1 files changed, 41 insertions, 11 deletions
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index 92dfa686d5..c116265c86 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -40,11 +40,38 @@
#include "llnotificationsutil.h"
/****
- * LLEnvironmentRequestResponder
+ * LLEnvironmentRequest
****/
-int LLEnvironmentRequestResponder::sCount = 0; // init to 0
+// static
+bool LLEnvironmentRequest::initiate()
+{
+ LLViewerRegion* cur_region = gAgent.getRegion();
+
+ if (!cur_region->capabilitiesReceived())
+ {
+ LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
+ cur_region->setCapabilitiesReceivedCallback(boost::bind(&LLEnvironmentRequest::onRegionCapsReceived, _1));
+ return false;
+ }
-/*static*/ bool LLEnvironmentRequestResponder::initiateRequest()
+ return doRequest();
+}
+
+// static
+void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id)
+{
+ if (region_id != gAgent.getRegion()->getRegionID())
+ {
+ LL_INFOS("WindlightCaps") << "Got caps for a non-current region" << LL_ENDL;
+ return;
+ }
+
+ LL_DEBUGS("WindlightCaps") << "Received region capabilities" << LL_ENDL;
+ doRequest();
+}
+
+// static
+bool LLEnvironmentRequest::doRequest()
{
std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings");
if (url.empty())
@@ -53,20 +80,24 @@ int LLEnvironmentRequestResponder::sCount = 0; // init to 0
// region is apparently not capable of this; don't respond at all
return false;
}
- else
- {
- LL_DEBUGS("WindlightCaps") << "Requesting windlight settings via " << url << LL_ENDL;
- LLHTTPClient::get(url, new LLEnvironmentRequestResponder());
- return true;
- }
+
+ LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL;
+ LLHTTPClient::get(url, new LLEnvironmentRequestResponder());
+ return true;
}
+
+/****
+ * LLEnvironmentRequestResponder
+ ****/
+int LLEnvironmentRequestResponder::sCount = 0; // init to 0
+
LLEnvironmentRequestResponder::LLEnvironmentRequestResponder()
{
mID = ++sCount;
}
/*virtual*/ void LLEnvironmentRequestResponder::result(const LLSD& unvalidated_content)
{
- LL_DEBUGS("WindlightCaps") << "Receiving windlight settings..." << LL_ENDL;
+ LL_INFOS("WindlightCaps") << "Received region windlight settings" << LL_ENDL;
if (mID != sCount)
{
@@ -82,7 +113,6 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder()
return;
}
- LL_DEBUGS("WindlightCaps") << "content: " << unvalidated_content << LL_ENDL;
LLEnvManager::getInstance()->processIncomingMessage(unvalidated_content, LLEnvKey::SCOPE_REGION);
}
/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason)