summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2012-03-08 18:18:53 -0700
committerXiaohong Bao <bao@lindenlab.com>2012-03-08 18:18:53 -0700
commite496796afba46c8f7be1d051cf48bdd667525bb1 (patch)
tree33f3f27e864be59bf315ea7b78026569bae65e22
parent5d914f475b9cc315d819653601144764993a32c8 (diff)
parenta98516c95ef6ba795b4fb5bff65105a2edb23ed2 (diff)
Automated merge with http://bitbucket.org/simon_linden/viewmaster
-rw-r--r--indra/llmessage/llcurl.cpp48
-rw-r--r--indra/llmessage/llcurl.h3
-rw-r--r--indra/newview/llworld.cpp5
3 files changed, 36 insertions, 20 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 2ef43d9c00..bac3e6c426 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -548,6 +548,7 @@ LLCurl::Multi::Multi(F32 idle_time_out)
mErrorCount(0),
mState(STATE_READY),
mDead(FALSE),
+ mValid(TRUE),
mMutexp(NULL),
mDeletionMutexp(NULL),
mEasyMutexp(NULL)
@@ -584,6 +585,9 @@ LLCurl::Multi::Multi(F32 idle_time_out)
LLCurl::Multi::~Multi()
{
cleanup(true) ;
+
+ delete mDeletionMutexp ;
+ mDeletionMutexp = NULL ;
}
void LLCurl::Multi::cleanup(bool deleted)
@@ -592,7 +596,10 @@ void LLCurl::Multi::cleanup(bool deleted)
{
return ; //nothing to clean.
}
+ llassert_always(deleted || !mValid) ;
+ LLMutexLock lock(mDeletionMutexp);
+
// Clean up active
for(easy_active_list_t::iterator iter = mEasyActiveList.begin();
iter != mEasyActiveList.end(); ++iter)
@@ -615,14 +622,12 @@ void LLCurl::Multi::cleanup(bool deleted)
check_curl_multi_code(LLCurl::deleteMultiHandle(mCurlMultiHandle));
mCurlMultiHandle = NULL ;
-
+
delete mMutexp ;
mMutexp = NULL ;
- delete mDeletionMutexp ;
- mDeletionMutexp = NULL ;
delete mEasyMutexp ;
mEasyMutexp = NULL ;
-
+
mQueued = 0 ;
mState = STATE_COMPLETED;
@@ -649,10 +654,20 @@ void LLCurl::Multi::unlock()
void LLCurl::Multi::markDead()
{
- LLMutexLock lock(mDeletionMutexp) ;
+ {
+ LLMutexLock lock(mDeletionMutexp) ;
+
+ if(mCurlMultiHandle != NULL)
+ {
+ mDead = TRUE ;
+ LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ;
+
+ return;
+ }
+ }
- mDead = TRUE ;
- LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ;
+ //not valid, delete it.
+ delete this;
}
void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state)
@@ -746,10 +761,14 @@ bool LLCurl::Multi::doPerform()
setState(STATE_COMPLETED) ;
mIdleTimer.reset() ;
}
- else if(mIdleTimer.getElapsedTimeF32() > mIdleTimeOut) //idle for too long, remove it.
+ else if(!mValid && mIdleTimer.getElapsedTimeF32() > mIdleTimeOut) //idle for too long, remove it.
{
dead = true ;
}
+ else if(mValid && mIdleTimer.getElapsedTimeF32() > mIdleTimeOut - 1.f) //idle for too long, mark it invalid.
+ {
+ mValid = FALSE ;
+ }
return dead ;
}
@@ -971,14 +990,7 @@ void LLCurlThread::killMulti(LLCurl::Multi* multi)
return ;
}
- if(multi->isValid())
- {
- multi->markDead() ;
- }
- else
- {
- deleteMulti(multi) ;
- }
+ multi->markDead() ;
}
//private
@@ -997,6 +1009,10 @@ void LLCurlThread::deleteMulti(LLCurl::Multi* multi)
void LLCurlThread::cleanupMulti(LLCurl::Multi* multi)
{
multi->cleanup() ;
+ if(multi->isDead()) //check if marked dead during cleaning up.
+ {
+ deleteMulti(multi) ;
+ }
}
//------------------------------------------------------------
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 579ba0b1ab..d6a7714d4c 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -304,7 +304,7 @@ public:
ePerformState getState() ;
bool isCompleted() ;
- bool isValid() {return mCurlMultiHandle != NULL ;}
+ bool isValid() {return mCurlMultiHandle != NULL && mValid;}
bool isDead() {return mDead;}
bool waitToComplete() ;
@@ -333,6 +333,7 @@ private:
ePerformState mState;
BOOL mDead ;
+ BOOL mValid ;
LLMutex* mMutexp ;
LLMutex* mDeletionMutexp ;
LLMutex* mEasyMutexp ;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 676287c0ad..5740ba1ccf 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -839,7 +839,6 @@ void LLWorld::updateWaterObjects()
// Now, get a list of the holes
S32 x, y;
- F32 water_height = gAgent.getRegion()->getWaterHeight() + 256.f;
for (x = min_x; x <= max_x; x += rwidth)
{
for (y = min_y; y <= max_y; y += rwidth)
@@ -851,7 +850,7 @@ void LLWorld::updateWaterObjects()
waterp->setUseTexture(FALSE);
waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
y + rwidth/2,
- water_height));
+ 256.f+DEFAULT_WATER_HEIGHT));
waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
gPipeline.createObject(waterp);
mHoleWaterObjects.push_back(waterp);
@@ -908,7 +907,7 @@ void LLWorld::updateWaterObjects()
}
waterp->setRegion(gAgent.getRegion());
- LLVector3d water_pos(water_center_x, water_center_y, water_height) ;
+ LLVector3d water_pos(water_center_x, water_center_y, 256.f+DEFAULT_WATER_HEIGHT) ;
LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
//stretch out to horizon