Increase connect time outs for SSL/TLS connections to 30 seconds.

On (very) slow machines this might improve the experience.
This only has effect on Second Life, since that's currently the only
grid that uses https for capabilities (all of them, except GetMesh,
GetMesh2 and GetTexture).

When linking the viewer with libmemleak, which significantly slows
down calls to malloc (and calloc, realloc, new, memalign and so on)
and free (delete), I no longer could download my inventory.
With this patch this was solved. The reason was that completing
the SSL/TLS handshake took more than 10 seconds (15 to 20).
This commit is contained in:
Aleric Inglewood
2013-11-21 19:47:25 +01:00
parent 1aa0a9be67
commit 2a7b96fab2
2 changed files with 9 additions and 1 deletions

View File

@@ -1095,6 +1095,7 @@ void CurlEasyRequest::finalizeRequest(std::string const& url, AIHTTPTimeoutPolic
DoutCurlEntering("CurlEasyRequest::finalizeRequest(\"" << url << "\", " << policy.name() << ", " << (void*)state_machine << ")");
llassert(!mTimeoutPolicy); // May only call finalizeRequest once!
mResult = CURLE_FAILED_INIT; // General error code; the final result code is stored here by MultiHandle::check_msg_queue when msg is CURLMSG_DONE.
mIsHttps = strncmp(url.c_str(), "https:", 6) == 0;
#ifdef SHOW_ASSERT
// Do a sanity check on the headers.
int content_type_count = 0;
@@ -1139,7 +1140,13 @@ void CurlEasyRequest::finalizeRequest(std::string const& url, AIHTTPTimeoutPolic
// // get less connect time, while it still (also) has to wait for this DNS lookup.
void CurlEasyRequest::set_timeout_opts(void)
{
setopt(CURLOPT_CONNECTTIMEOUT, mTimeoutPolicy->getConnectTimeout(getLowercaseHostname()));
U16 connect_timeout = mTimeoutPolicy->getConnectTimeout(getLowercaseHostname());
if (mIsHttps && connect_timeout < 30)
{
DoutCurl("Incrementing CURLOPT_CONNECTTIMEOUT of \"" << mTimeoutPolicy->name() << "\" from " << connect_timeout << " to 30 seconds.");
connect_timeout = 30;
}
setopt(CURLOPT_CONNECTTIMEOUT, connect_timeout);
setopt(CURLOPT_TIMEOUT, mTimeoutPolicy->getCurlTransaction());
}

View File

@@ -315,6 +315,7 @@ class CurlEasyRequest : public CurlEasyHandle {
AIPerServicePtr mPerServicePtr; // Pointer to the corresponding AIPerService.
LLPointer<curlthread::HTTPTimeout> mTimeout;// Timeout administration object associated with last created CurlSocketInfo.
bool mTimeoutIsOrphan; // Set to true when mTimeout is not (yet) associated with a CurlSocketInfo.
bool mIsHttps; // Set if the url starts with "https:".
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
public:
bool mDebugIsHeadOrGetMethod;