diff options
Diffstat (limited to 'indra/llmessage/llcurl.cpp')
-rw-r--r-- | indra/llmessage/llcurl.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 2b351d351e..f569630766 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -517,7 +517,7 @@ void LLCurl::Easy::prepRequest(const std::string& url, } //////////////////////////////////////////////////////////////////////////// - +LLMutex* LLCurl::Multi::sMultiInitMutexp = NULL ; LLCurl::Multi::Multi() : mQueued(0), mErrorCount(0), @@ -527,11 +527,11 @@ LLCurl::Multi::Multi() mDeletionMutexp(NULL), mEasyMutexp(NULL) { - mCurlMultiHandle = curl_multi_init(); + mCurlMultiHandle = initMulti(); if (!mCurlMultiHandle) { llwarns << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl; - mCurlMultiHandle = curl_multi_init(); + mCurlMultiHandle = initMulti(); } llassert_always(mCurlMultiHandle); @@ -576,6 +576,13 @@ LLCurl::Multi::~Multi() --gCurlMultiCount; } +CURLM* LLCurl::Multi::initMulti() +{ + LLMutexLock lock(sMultiInitMutexp) ; + + return curl_multi_init() ; +} + void LLCurl::Multi::lock() { if(mMutexp) @@ -853,11 +860,17 @@ void LLCurlThread::CurlRequest::finishRequest(bool completed) LLCurlThread::LLCurlThread(bool threaded) : LLQueuedThread("curlthread", threaded) { + if(!LLCurl::Multi::sMultiInitMutexp) + { + LLCurl::Multi::sMultiInitMutexp = new LLMutex(NULL) ; + } } //virtual LLCurlThread::~LLCurlThread() { + delete LLCurl::Multi::sMultiInitMutexp ; + LLCurl::Multi::sMultiInitMutexp = NULL ; } S32 LLCurlThread::update(U32 max_time_ms) |