diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-04 09:59:57 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-04 09:59:57 -0500 |
commit | a3e30250e8dc16d976e1df5d50bfdca28aec6d7e (patch) | |
tree | 6269e0d5a461c4cde9cc07f2d1f54a1eb3f4e036 /indra/llmessage/llcurl.cpp | |
parent | 1620ad6d00a77b2089e0ae5f6de30f9a954c6167 (diff) | |
parent | 570d562f5871f40bd7f8c683db5316ffd0133335 (diff) |
merge
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 5027e8fa84..e17380fdf5 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) @@ -857,11 +864,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(F32 max_time_ms) |