diff options
author | Merov Linden <merov@lindenlab.com> | 2014-06-17 09:50:48 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-06-17 09:50:48 -0700 |
commit | 9c792f03b4f006f5083c9fc98047bfad6bee8e16 (patch) | |
tree | 5e15865f837e4d7815000b79452f4bdd7245d511 /indra/llmessage | |
parent | f79b1139fd28b29c51a0c001960ef3f0bb999ec0 (diff) | |
parent | 977476171ddcc057d7c28b6c14ae988b8189ed75 (diff) |
Pull merge from lindenlab/viewer-release
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-x | indra/llmessage/llares.cpp | 9 | ||||
-rwxr-xr-x | indra/llmessage/llares.h | 1 | ||||
-rwxr-xr-x | indra/llmessage/llcurl.cpp | 45 | ||||
-rwxr-xr-x | indra/llmessage/llcurl.h | 3 | ||||
-rwxr-xr-x | indra/llmessage/llhttpclient.cpp | 2 |
5 files changed, 50 insertions, 10 deletions
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index 81e28121fd..9f90ae1544 100755 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -610,6 +610,15 @@ LLAres *ll_init_ares() return gAres; } +void ll_cleanup_ares() +{ + if (gAres != NULL) + { + delete gAres; + gAres = NULL; + } +} + LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name, unsigned ttl) : LLRefCount(), diff --git a/indra/llmessage/llares.h b/indra/llmessage/llares.h index 800781ee88..0b5d49e322 100755 --- a/indra/llmessage/llares.h +++ b/indra/llmessage/llares.h @@ -578,5 +578,6 @@ extern LLAres *gAres; * thread safe. */ extern LLAres *ll_init_ares(); +extern void ll_cleanup_ares(); #endif // LL_LLARES_H diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index a80d5a570e..73df47b933 100755 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -349,6 +349,36 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) } } +//static +void LLCurl::Easy::deleteAllActiveHandles() +{ + LLMutexLock lock(sHandleMutexp) ; + LL_CHECK_MEMORY + for (std::set<CURL*>::iterator activeHandle = sActiveHandles.begin(); activeHandle != sActiveHandles.end(); ++activeHandle) + { + CURL* curlHandle = *activeHandle; + LLCurl::deleteEasyHandle(curlHandle); + LL_CHECK_MEMORY + } + + sFreeHandles.clear(); +} + +//static +void LLCurl::Easy::deleteAllFreeHandles() +{ + LLMutexLock lock(sHandleMutexp) ; + LL_CHECK_MEMORY + for (std::set<CURL*>::iterator freeHandle = sFreeHandles.begin(); freeHandle != sFreeHandles.end(); ++freeHandle) + { + CURL* curlHandle = *freeHandle; + LLCurl::deleteEasyHandle(curlHandle); + LL_CHECK_MEMORY + } + + sFreeHandles.clear(); +} + LLCurl::Easy::Easy() : mHeaders(NULL), mCurlEasyHandle(NULL) @@ -1857,17 +1887,14 @@ void LLCurl::cleanupClass() #endif LL_CHECK_MEMORY - - for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter) - { - CURL* curl = *iter; - LLCurl::deleteEasyHandle(curl); - } - + Easy::deleteAllFreeHandles(); + LL_CHECK_MEMORY + Easy::deleteAllActiveHandles(); LL_CHECK_MEMORY - Easy::sFreeHandles.clear(); - + // Free the template easy handle + curl_easy_cleanup(sCurlTemplateStandardHandle); + sCurlTemplateStandardHandle = NULL; LL_CHECK_MEMORY delete Easy::sHandleMutexp ; diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index bd6b0b3fd4..385d9fffa8 100755 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -304,6 +304,9 @@ private: static std::set<CURL*> sFreeHandles; static std::set<CURL*> sActiveHandles; static LLMutex* sHandleMutexp ; + + static void deleteAllActiveHandles(); + static void deleteAllFreeHandles(); }; class LLCurl::Multi diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 801cf83fae..a8c3b86192 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -127,7 +127,7 @@ namespace { public: RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {} - virtual ~RawInjector() {delete mData;} + virtual ~RawInjector() {delete [] mData;} const std::string& contentType() { return HTTP_CONTENT_OCTET_STREAM; } |