Skip to content
Snippets Groups Projects
Commit 6e483af1 authored by simon's avatar simon
Browse files

Revert ares and libcurl version update that was causing problems, revise curl

handle duplication code.  Reviewed by Kelly
parent c4a45fca
No related branches found
No related tags found
No related merge requests found
......@@ -138,9 +138,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>4dd93da518dc00319cadac43dce2676b</string>
<string>e6caaeea16131e1f2343ecd7765e3147</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ares/rev/239515/arch/Darwin/installer/ares-1.7.5-darwin-20110825.tar.bz2</string>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/ares-1.7.1-darwin-20110217.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
......@@ -150,9 +150,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>c223c0df8ebdab02a5bd785c21459875</string>
<string>0745872db83d45f4ab3bdc697d98e264</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ares/rev/239515/arch/Linux/installer/ares-1.7.5-linux-20110825.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ares/rev/223275/arch/Linux/installer/ares-1.7.1-linux-20110310.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
......@@ -162,9 +162,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>a0a002359e44a9c68f897b45217abf7e</string>
<string>1dcec6babd249a2597114d4ac226c461</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ares/rev/239515/arch/CYGWIN/installer/ares-1.7.5-windows-20110825.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ares/rev/220963/arch/CYGWIN/installer/ares-1.7.1-windows-20110211.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
......@@ -282,9 +282,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>6f6b4fc6268e7935e82e694ed3f5912a</string>
<string>aaea644191807f51051cefa2fac11069</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-curl/rev/249347/arch/Darwin/installer/curl-7.24.0-darwin-20120213.tar.bz2</string>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.21.1-darwin-20110316.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
......@@ -294,9 +294,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>384e6d46f2f4228117cda7eea396df06</string>
<string>2d9377951d99a1aa4735cea8d4b5aa71</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-curl/rev/263749/arch/Linux/installer/curl-7.24.0-linux-20120820.tar.bz2</string>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.21.1-linux-20110316.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
......@@ -306,9 +306,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>56c72a3b4d6faab81a4d66a630a67c83</string>
<string>fea96aa2a7d513397317194f3d6c979b</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-curl/rev/249347/arch/CYGWIN/installer/curl-7.24.0-windows-20120213.tar.bz2</string>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.21.1-windows-20110211.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
......
......@@ -146,9 +146,6 @@ const int HTTP_SERVICE_LOOP_SLEEP_NORMAL_MS = 2;
// Block allocation size (a tuning parameter) is found
// in bufferarray.h.
// Compatibility controls
const bool HTTP_ENABLE_LINKSYS_WRT54G_V5_DNS_FIX = true;
} // end namespace LLCore
#endif // _LLCORE_HTTP_INTERNAL_H_
......@@ -380,18 +380,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
// Get policy options
HttpPolicyGlobal & policy(service->getPolicy().getGlobalOptions());
mCurlHandle = LLCurlHandleHandler::getInstance()->CreateCurlHandle();
if (HTTP_ENABLE_LINKSYS_WRT54G_V5_DNS_FIX)
{
// The Linksys WRT54G V5 router has an issue with frequent
// DNS lookups from LAN machines. If they happen too often,
// like for every HTTP request, the router gets annoyed after
// about 700 or so requests and starts issuing TCP RSTs to
// new connections. Reuse the DNS lookups for even a few
// seconds and no RSTs.
curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 15);
}
mCurlHandle = LLCurl::createStandardCurlHandle();
curl_easy_setopt(mCurlHandle, CURLOPT_WRITEFUNCTION, writeCallback);
curl_easy_setopt(mCurlHandle, CURLOPT_READFUNCTION, readCallback);
......
......@@ -29,7 +29,6 @@
#include "linden_common.h" // Modifies curl/curl.h interfaces
#include "llsingleton.h"
#include <string>
#include <curl/curl.h>
......@@ -66,8 +65,6 @@ class HttpOpRequest : public HttpOperation
public:
HttpOpRequest();
friend class CurlHandleHandler;
protected:
virtual ~HttpOpRequest(); // Use release()
......
......@@ -92,6 +92,7 @@ S32 LLCurl::sTotalHandles = 0 ;
bool LLCurl::sNotQuitting = true;
F32 LLCurl::sCurlRequestTimeOut = 120.f; //seonds
S32 LLCurl::sMaxHandles = 256; //max number of handles, (multi handles and easy handles combined).
CURL* LLCurl::sCurlTemplateStandardHandle = NULL;
void check_curl_code(CURLcode code)
{
......@@ -1815,7 +1816,7 @@ CURL* LLCurl::newEasyHandle()
}
sTotalHandles++;
CURL* ret = LLCurlHandleHandler::getInstance()->CreateCurlHandle();
CURL* ret = createStandardCurlHandle();
if(!ret)
{
llwarns << "failed to create curl handle." << llendl ;
......@@ -1849,23 +1850,46 @@ void LLCurlFF::check_multi_code(CURLMcode code)
check_curl_multi_code(code);
}
CURL* LLCurlHandleHandler::the_one_true_curl_handle;
LLCurlHandleHandler::LLCurlHandleHandler()
// Static
CURL* LLCurl::createStandardCurlHandle()
{
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);
}
if (sCurlTemplateStandardHandle == NULL)
{ // Late creation of the template curl handle
sCurlTemplateStandardHandle = curl_easy_init();
if (sCurlTemplateStandardHandle == NULL)
{
llwarns << "curl error calling curl_easy_init()" << llendl;
}
else
{
CURLcode result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_NOSIGNAL, 1);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_NOPROGRESS, 1);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_ENCODING, "");
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_AUTOREFERER, 1);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_FOLLOWLOCATION, 1);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_SSL_VERIFYPEER, 1);
check_curl_code(result);
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_SSL_VERIFYHOST, 0);
check_curl_code(result);
// The Linksys WRT54G V5 router has an issue with frequent
// DNS lookups from LAN machines. If they happen too often,
// like for every HTTP request, the router gets annoyed after
// about 700 or so requests and starts issuing TCP RSTs to
// new connections. Reuse the DNS lookups for even a few
// seconds and no RSTs.
result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_DNS_CACHE_TIMEOUT, 15);
check_curl_code(result);
}
}
CURL* LLCurlHandleHandler::CreateCurlHandle()
{
return curl_easy_duphandle(the_one_true_curl_handle);
return curl_easy_duphandle(sCurlTemplateStandardHandle);
}
......@@ -53,14 +53,6 @@ class LLCurlThread;
// For whatever reason, this is not typedef'd in curl.h
typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
class LLCurlHandleHandler : public LLSingleton<LLCurlHandleHandler>
{
public:
static CURL* the_one_true_curl_handle;
LLCurlHandleHandler();
static CURL* CreateCurlHandle();
};
class LLCurl
{
LOG_CLASS(LLCurl);
......@@ -196,6 +188,8 @@ class LLCurl
static CURL* newEasyHandle() ;
static void deleteEasyHandle(CURL* handle) ;
static CURL* createStandardCurlHandle();
private:
static std::string sCAPath;
static std::string sCAFile;
......@@ -205,6 +199,7 @@ class LLCurl
static LLMutex* sHandleMutexp ;
static S32 sTotalHandles ;
static S32 sMaxHandles;
static CURL* sCurlTemplateStandardHandle;
public:
static bool sNotQuitting;
static F32 sCurlRequestTimeOut;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment