summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcurl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage/llcurl.cpp')
-rw-r--r--indra/llmessage/llcurl.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 8ffa8e4271..5b9965680d 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -72,7 +72,8 @@
static const U32 EASY_HANDLE_POOL_SIZE = 5;
static const S32 MULTI_PERFORM_CALL_REPEAT = 5;
-static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds per operation
+static const S32 CURL_REQUEST_TIMEOUT = 120; // seconds per operation
+static const S32 CURL_CONNECT_TIMEOUT = 30; //seconds to wait for a connection
static const S32 MAX_ACTIVE_REQUEST_COUNT = 100;
// DEBUG //
@@ -515,6 +516,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
//don't verify host name so urls with scrubbed host names will work (improves DNS performance)
setopt(CURLOPT_SSL_VERIFYHOST, 0);
setopt(CURLOPT_TIMEOUT, llmax(time_out, CURL_REQUEST_TIMEOUT));
+ setopt(CURLOPT_CONNECTTIMEOUT, CURL_CONNECT_TIMEOUT);
setoptString(CURLOPT_URL, url);
@@ -1811,10 +1813,10 @@ CURL* LLCurl::newEasyHandle()
}
sTotalHandles++;
- CURL* ret = curl_easy_init() ;
+ CURL* ret = LLCurlHandleHandler::getInstance()->CreateCurlHandle();
if(!ret)
{
- llwarns << "curl_easy_init failed." << llendl ;
+ llwarns << "failed to create curl handle." << llendl ;
}
return ret ;
@@ -1844,3 +1846,24 @@ void LLCurlFF::check_multi_code(CURLMcode code)
{
check_curl_multi_code(code);
}
+
+CURL* LLCurlHandleHandler::the_one_true_curl_handle;
+
+LLCurlHandleHandler::LLCurlHandleHandler()
+{
+ the_one_true_curl_handle = curl_easy_init();
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_NOPROGRESS, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_ENCODING, "");
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_AUTOREFERER, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
+}
+
+CURL* LLCurlHandleHandler::CreateCurlHandle()
+{
+ return curl_easy_duphandle(the_one_true_curl_handle);
+}