summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-12-20 11:04:10 -0700
committerXiaohong Bao <bao@lindenlab.com>2011-12-20 11:04:10 -0700
commitcfc6ac76e1c700c0810629b005f45747c4144867 (patch)
tree82a8e5e1638217981772a7cb5e1ac1a76ad91b29 /indra/llmessage
parent43e3603cd763f5f501c8c5dc008d8a00d0744c53 (diff)
more tuning of llcurl code targeting crashes like SH-2777.
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcurl.cpp43
1 files changed, 32 insertions, 11 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 988c12d6fb..2b351d351e 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -603,11 +603,12 @@ void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state)
{
lock() ;
mState = state ;
+ unlock() ;
+
if(mState == STATE_READY)
{
LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ;
- }
- unlock() ;
+ }
}
LLCurl::Multi::ePerformState LLCurl::Multi::getState()
@@ -628,9 +629,7 @@ bool LLCurl::Multi::waitToComplete()
return true ;
}
- bool completed ;
-
- completed = (STATE_COMPLETED == mState) ;
+ bool completed = (STATE_COMPLETED == mState) ;
if(!completed)
{
LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ;
@@ -641,6 +640,8 @@ bool LLCurl::Multi::waitToComplete()
CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
{
+ LLMutexLock lock(mMutexp) ;
+
CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue);
return curlmsg;
}
@@ -702,10 +703,19 @@ S32 LLCurl::Multi::process()
if (msg->msg == CURLMSG_DONE)
{
U32 response = 0;
- easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
- if (iter != mEasyActiveMap.end())
+ Easy* easy = NULL ;
+
+ {
+ LLMutexLock lock(mEasyMutexp) ;
+ easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
+ if (iter != mEasyActiveMap.end())
+ {
+ easy = iter->second;
+ }
+ }
+
+ if(easy)
{
- Easy* easy = iter->second;
response = easy->report(msg->data.result);
removeEasy(easy);
}
@@ -766,20 +776,31 @@ bool LLCurl::Multi::addEasy(Easy* easy)
void LLCurl::Multi::easyFree(Easy* easy)
{
- mEasyMutexp->lock() ;
+ if(mEasyMutexp)
+ {
+ mEasyMutexp->lock() ;
+ }
+
mEasyActiveList.erase(easy);
mEasyActiveMap.erase(easy->getCurlHandle());
if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE)
{
mEasyFreeList.insert(easy);
- mEasyMutexp->unlock() ;
+
+ if(mEasyMutexp)
+ {
+ mEasyMutexp->unlock() ;
+ }
easy->resetState();
}
else
{
- mEasyMutexp->unlock() ;
+ if(mEasyMutexp)
+ {
+ mEasyMutexp->unlock() ;
+ }
delete easy;
}
}