WIP: Make curl thread code robust and flexible.
Conflicts: indra/llmessage/llcurl.cpp indra/llmessage/llcurl.h indra/newview/app_settings/settings.xml indra/newview/llappviewer.cpp indra/newview/llmeshrepository.cpp Resolved: indra/llmessage/llcurl.cpp: Basically removed (not used anyway) indra/llmessage/llcurl.h: Basically removed (just includes aiculr.h now) indra/newview/app_settings/settings.xml: CurlUseMultipleThreads was remvoved. CurlMaximumNumberOfHandles and CurlRequestTimeOut are still in there, but unused at the moment. indra/newview/llappviewer.cpp: CurlMaximumNumberOfHandles and CurlRequestTimeOut are unused at the moment. indra/newview/llmeshrepository.cpp: Lock mSignal always (is unlocked inside wait()). Use mSignal lock to see if we are waiting; remove mWaiting. Return false from the MeshFetch functions iff we have to retry a HTTP fetch. Catch the error exception thrown by getByteRange instead of using it's return value (always returns true anyway).
This commit is contained in:
@@ -255,7 +255,16 @@ static void request(const std::string &url,
|
||||
}
|
||||
LLPumpIO::chain_t chain;
|
||||
|
||||
LLURLRequest *req = new LLURLRequest(method, url);
|
||||
LLURLRequest *req;
|
||||
try
|
||||
{
|
||||
req = new LLURLRequest(method, url);
|
||||
}
|
||||
catch(AICurlNoEasyHandle const& error)
|
||||
{
|
||||
llwarns << "Failed to create LLURLRequest: " << error.what() << llendl;
|
||||
return;
|
||||
}
|
||||
req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
|
||||
|
||||
/*
|
||||
@@ -324,10 +333,11 @@ int HippoRestRequest::getBlocking(const std::string &url, std::string *result)
|
||||
|
||||
char curlErrorBuffer[CURL_ERROR_SIZE];
|
||||
CURL* curlp = curl_easy_init();
|
||||
llassert_always(curlp);
|
||||
|
||||
curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
|
||||
curl_easy_setopt(curlp, CURLOPT_TIMEOUT, 5); // seconds
|
||||
curl_easy_setopt(curlp, CURLOPT_CAINFO, gDirUtilp->getCAFile().c_str());
|
||||
curl_easy_setopt(curlp, CURLOPT_CAINFO, gDirUtilp->getCAFile().c_str());
|
||||
|
||||
curl_easy_setopt(curlp, CURLOPT_WRITEFUNCTION, curlWrite);
|
||||
curl_easy_setopt(curlp, CURLOPT_WRITEDATA, result);
|
||||
@@ -337,7 +347,7 @@ int HippoRestRequest::getBlocking(const std::string &url, std::string *result)
|
||||
|
||||
*result = "";
|
||||
S32 curlSuccess = curl_easy_perform(curlp);
|
||||
S32 httpStatus = 499;
|
||||
long httpStatus = 499L; // curl_easy_getinfo demands pointer to long.
|
||||
curl_easy_getinfo(curlp, CURLINFO_RESPONSE_CODE, &httpStatus);
|
||||
|
||||
if (curlSuccess != 0) {
|
||||
|
||||
Reference in New Issue
Block a user