aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerregion.cpp133
1 files changed, 74 insertions, 59 deletions
diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp
index e1590cc..f745aca 100644
--- a/linden/indra/newview/llviewerregion.cpp
+++ b/linden/indra/newview/llviewerregion.cpp
@@ -76,7 +76,74 @@ extern BOOL gNoRender;
76const F32 WATER_TEXTURE_SCALE = 8.f; // Number of times to repeat the water texture across a region 76const F32 WATER_TEXTURE_SCALE = 8.f; // Number of times to repeat the water texture across a region
77const S16 MAX_MAP_DIST = 10; 77const S16 MAX_MAP_DIST = 10;
78 78
79class BaseCapabilitiesComplete : public LLHTTPClient::Responder
80{
81 LOG_CLASS(BaseCapabilitiesComplete);
82public:
83 BaseCapabilitiesComplete(LLViewerRegion* region)
84 : mRegion(region)
85 { }
86 virtual ~BaseCapabilitiesComplete()
87 {
88 if(mRegion)
89 {
90 mRegion->setHttpResponderPtrNULL() ;
91 }
92 }
79 93
94 void setRegion(LLViewerRegion* region)
95 {
96 mRegion = region ;
97 }
98
99 void error(U32 statusNum, const std::string& reason)
100 {
101 LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL;
102
103 if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
104 {
105 LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
106 }
107 }
108
109 void result(const LLSD& content)
110 {
111 if(!mRegion || this != mRegion->getHttpResponderPtr())//region is removed or responder is not created.
112 {
113 return ;
114 }
115
116 LLSD::map_const_iterator iter;
117 for(iter = content.beginMap(); iter != content.endMap(); ++iter)
118 {
119 mRegion->setCapability(iter->first, iter->second);
120 LL_DEBUGS2("AppInit", "Capabilities") << "got capability for "
121 << iter->first << LL_ENDL;
122
123 /* HACK we're waiting for the ServerReleaseNotes */
124 if ((iter->first == "ServerReleaseNotes") && (LLFloaterReleaseMsg::sDisplayMessage))
125 {
126 LLFloaterReleaseMsg::show();
127 LLFloaterReleaseMsg::sDisplayMessage = false;
128 }
129 }
130
131 if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
132 {
133 LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
134 }
135 }
136
137 static boost::intrusive_ptr<BaseCapabilitiesComplete> build(
138 LLViewerRegion* region)
139 {
140 return boost::intrusive_ptr<BaseCapabilitiesComplete>(
141 new BaseCapabilitiesComplete(region));
142 }
143
144private:
145 LLViewerRegion* mRegion;
146};
80 147
81 148
82LLViewerRegion::LLViewerRegion(const U64 &handle, 149LLViewerRegion::LLViewerRegion(const U64 &handle,
@@ -103,7 +170,6 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
103 mEventPoll(NULL) 170 mEventPoll(NULL)
104{ 171{
105 mWidth = region_width_meters; 172 mWidth = region_width_meters;
106
107 mOriginGlobal = from_region_handle(handle); 173 mOriginGlobal = from_region_handle(handle);
108 updateRenderMatrix(); 174 updateRenderMatrix();
109 175
@@ -170,10 +236,13 @@ void LLViewerRegion::initStats()
170 mAlive = FALSE; // can become false if circuit disconnects 236 mAlive = FALSE; // can become false if circuit disconnects
171} 237}
172 238
173
174
175LLViewerRegion::~LLViewerRegion() 239LLViewerRegion::~LLViewerRegion()
176{ 240{
241 if(mHttpResponderPtr)
242 {
243 (static_cast<BaseCapabilitiesComplete*>(mHttpResponderPtr.get()))->setRegion(NULL) ;
244 }
245
177 gVLManager.cleanupData(this); 246 gVLManager.cleanupData(this);
178 // Can't do this on destruction, because the neighbor pointers might be invalid. 247 // Can't do this on destruction, because the neighbor pointers might be invalid.
179 // This should be reference counted... 248 // This should be reference counted...
@@ -1303,61 +1372,6 @@ void LLViewerRegion::unpackRegionHandshake()
1303 msg->sendReliable(host); 1372 msg->sendReliable(host);
1304} 1373}
1305 1374
1306
1307
1308class BaseCapabilitiesComplete : public LLHTTPClient::Responder
1309{
1310 LOG_CLASS(BaseCapabilitiesComplete);
1311public:
1312 BaseCapabilitiesComplete(LLViewerRegion* region)
1313 : mRegion(region)
1314 { }
1315
1316 void error(U32 statusNum, const std::string& reason)
1317 {
1318 LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL;
1319
1320 if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
1321 {
1322 LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
1323 }
1324 }
1325
1326 void result(const LLSD& content)
1327 {
1328 LLSD::map_const_iterator iter;
1329 for(iter = content.beginMap(); iter != content.endMap(); ++iter)
1330 {
1331 mRegion->setCapability(iter->first, iter->second);
1332 LL_DEBUGS2("AppInit", "Capabilities") << "got capability for "
1333 << iter->first << LL_ENDL;
1334
1335 /* HACK we're waiting for the ServerReleaseNotes */
1336 if ((iter->first == "ServerReleaseNotes") && (LLFloaterReleaseMsg::sDisplayMessage))
1337 {
1338 LLFloaterReleaseMsg::show();
1339 LLFloaterReleaseMsg::sDisplayMessage = false;
1340 }
1341 }
1342
1343 if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState())
1344 {
1345 LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
1346 }
1347 }
1348
1349 static boost::intrusive_ptr<BaseCapabilitiesComplete> build(
1350 LLViewerRegion* region)
1351 {
1352 return boost::intrusive_ptr<BaseCapabilitiesComplete>(
1353 new BaseCapabilitiesComplete(region));
1354 }
1355
1356private:
1357 LLViewerRegion* mRegion;
1358};
1359
1360
1361void LLViewerRegion::setSeedCapability(const std::string& url) 1375void LLViewerRegion::setSeedCapability(const std::string& url)
1362{ 1376{
1363 if (getCapability("Seed") == url) 1377 if (getCapability("Seed") == url)
@@ -1408,7 +1422,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
1408 1422
1409 llinfos << "posting to seed " << url << llendl; 1423 llinfos << "posting to seed " << url << llendl;
1410 1424
1411 LLHTTPClient::post(url, capabilityNames, BaseCapabilitiesComplete::build(this)); 1425 mHttpResponderPtr = BaseCapabilitiesComplete::build(this) ;
1426 LLHTTPClient::post(url, capabilityNames, mHttpResponderPtr);
1412} 1427}
1413 1428
1414void LLViewerRegion::setCapability(const std::string& name, const std::string& url) 1429void LLViewerRegion::setCapability(const std::string& name, const std::string& url)