summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStinson Linden <stinson@lindenlab.com>2014-04-23 19:36:08 +0100
committerStinson Linden <stinson@lindenlab.com>2014-04-23 19:36:08 +0100
commitfd0e84296e1f20b90bc6e7c0ad4fbfcecf0aa6d9 (patch)
tree6b5c82f79887bf79606bd0bfe2cadb8eeb0b299c
parent5969c3d04f501d1c330674153702d32051daaf67 (diff)
MAINT-4009: Cleaning up the curl easy handle during shutdown.
-rwxr-xr-xindra/llmessage/llcurl.cpp45
-rwxr-xr-xindra/llmessage/llcurl.h3
2 files changed, 39 insertions, 9 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 147940c983..161b7c1615 100755
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -274,6 +274,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)
@@ -1745,17 +1775,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 fc9761ff9f..b033a3d4ab 100755
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -269,6 +269,9 @@ private:
static std::set<CURL*> sFreeHandles;
static std::set<CURL*> sActiveHandles;
static LLMutex* sHandleMutexp ;
+
+ static void deleteAllActiveHandles();
+ static void deleteAllFreeHandles();
};
class LLCurl::Multi