SH-4139 Convert http downloaders and responders to llcorehttp patterns

Wed, 08 May 2013 13:48:14 -0400

author
Monty Brandenberg <monty@lindenlab.com>
date
Wed, 08 May 2013 13:48:14 -0400
changeset 40676
73d52141f4c5
parent 40675
6289b8edf5fa
child 40677
e1ef342c2a58

SH-4139 Convert http downloaders and responders to llcorehttp patterns
Conversion was mostly trivial. Did some refactoring in the conversion
of Responders to Handlers which eliminated 5X code replication. More
will be done especially as this is extended to deal with the various
possible combinations of 200/206/416 status for ranged gets. There are
a lot of thread races in the existing code, that is going to need some
real attention. And the scheduling/liveness logic in the thread
management bounces around from thread to thread wasting a lot of time
and using expensive synchronization. Much can be done here. But the
result is that the 8 connections in the Mesh corehttp class now perform
as did the 32 connections of the original. And that 32 actually looks
like it could bleed to over 64. So, progress...

indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llmeshrepository.cpp	Tue May 07 17:27:12 2013 -0400
     1.2 +++ b/indra/newview/llmeshrepository.cpp	Wed May 08 13:48:14 2013 -0400
     1.3 @@ -756,25 +756,21 @@
     1.4  		if (! mHttpRequestSet.empty())
     1.5  		{
     1.6  			mHttpRequest->update(0L);
     1.7 -			ms_sleep(100);
     1.8  		}
     1.9 -		else
    1.10 -		{
    1.11 -			mWaiting = true;
    1.12 -			mSignal->wait();
    1.13 -			mWaiting = false;
    1.14 -		}
    1.15 +
    1.16 +		mWaiting = true;
    1.17 +		mSignal->wait();
    1.18 +		mWaiting = false;
    1.19  		
    1.20  		if (! LLApp::isQuitting())
    1.21  		{
    1.22  			static U32 count = 0;
    1.23 -
    1.24  			static F32 last_hundred = gFrameTimeSeconds;
    1.25  
    1.26  			if (gFrameTimeSeconds - last_hundred > 1.f)
    1.27  			{ //a second has gone by, clear count
    1.28  				last_hundred = gFrameTimeSeconds;
    1.29 -				count = 0;	
    1.30 +				count = 0;
    1.31  			}
    1.32  
    1.33  			// NOTE: throttling intentionally favors LOD requests over header requests
    1.34 @@ -1015,10 +1011,6 @@
    1.35  			std::string http_url = constructUrl(mesh_id);
    1.36  			if (!http_url.empty())
    1.37  			{
    1.38 -#if 0
    1.39 -				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
    1.40 -												 new LLMeshSkinInfoResponder(mesh_id, offset, size));
    1.41 -#else
    1.42  				LLMeshSkinInfoHandler * handler = new LLMeshSkinInfoHandler(mesh_id, offset, size);
    1.43  				// LL_WARNS("Mesh") << "MESH:  Issuing Skin Info Request" << LL_ENDL;
    1.44  				LLCore::HttpHandle handle = mHttpRequest->requestGetByteRange(mHttpPolicyClass,
    1.45 @@ -1040,10 +1032,6 @@
    1.46  				{
    1.47  					handler->mHttpHandle = handle;
    1.48  					mHttpRequestSet.insert(handler);
    1.49 -				}
    1.50 -#endif
    1.51 -				if (ret)
    1.52 -				{
    1.53  					LLMeshRepository::sHTTPRequestCount++;
    1.54  				}
    1.55  			}
    1.56 @@ -1122,10 +1110,6 @@
    1.57  			std::string http_url = constructUrl(mesh_id);
    1.58  			if (!http_url.empty())
    1.59  			{
    1.60 -#if 0
    1.61 -				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
    1.62 -												 new LLMeshDecompositionResponder(mesh_id, offset, size));
    1.63 -#else
    1.64  				LLMeshDecompositionHandler * handler = new LLMeshDecompositionHandler(mesh_id, offset, size);
    1.65  				// LL_WARNS("Mesh") << "MESH:  Issuing Decomp Request" << LL_ENDL;
    1.66  				LLCore::HttpHandle handle = mHttpRequest->requestGetByteRange(mHttpPolicyClass,
    1.67 @@ -1147,10 +1131,6 @@
    1.68  				{
    1.69  					handler->mHttpHandle = handle;
    1.70  					mHttpRequestSet.insert(handler);
    1.71 -				}
    1.72 -#endif
    1.73 -				if (ret)
    1.74 -				{
    1.75  					LLMeshRepository::sHTTPRequestCount++;
    1.76  				}
    1.77  			}
    1.78 @@ -1228,10 +1208,6 @@
    1.79  			std::string http_url = constructUrl(mesh_id);
    1.80  			if (!http_url.empty())
    1.81  			{
    1.82 -#if 0
    1.83 -				ret = mCurlRequest->getByteRange(http_url, headers, offset, size,
    1.84 -												 new LLMeshPhysicsShapeResponder(mesh_id, offset, size));
    1.85 -#else
    1.86  				LLMeshPhysicsShapeHandler * handler = new LLMeshPhysicsShapeHandler(mesh_id, offset, size);
    1.87  				// LL_WARNS("Mesh") << "MESH:  Issuing Physics Shape Request" << LL_ENDL;
    1.88  				LLCore::HttpHandle handle = mHttpRequest->requestGetByteRange(mHttpPolicyClass,
    1.89 @@ -1253,10 +1229,6 @@
    1.90  				{
    1.91  					handler->mHttpHandle = handle;
    1.92  					mHttpRequestSet.insert(handler);
    1.93 -				}
    1.94 -#endif
    1.95 -				if (ret)
    1.96 -				{
    1.97  					LLMeshRepository::sHTTPRequestCount++;
    1.98  				}
    1.99  			}
   1.100 @@ -1338,9 +1310,7 @@
   1.101  		//grab first 4KB if we're going to bother with a fetch.  Cache will prevent future fetches if a full mesh fits
   1.102  		//within the first 4KB
   1.103  		//NOTE -- this will break of headers ever exceed 4KB		
   1.104 -#if 0
   1.105 -		retval = mCurlRequest->getByteRange(http_url, headers, 0, MESH_HEADER_SIZE, new LLMeshHeaderResponder(mesh_params));
   1.106 -#else
   1.107 +
   1.108  		LLMeshHeaderHandler * handler = new LLMeshHeaderHandler(mesh_params);
   1.109  		// LL_WARNS("Mesh") << "MESH:  Issuing Request" << LL_ENDL;
   1.110  		LLCore::HttpHandle handle = mHttpRequest->requestGetByteRange(mHttpPolicyClass,
   1.111 @@ -1362,10 +1332,6 @@
   1.112  		{
   1.113  			handler->mHttpHandle = handle;
   1.114  			mHttpRequestSet.insert(handler);
   1.115 -		}
   1.116 -#endif		
   1.117 -		if(retval)
   1.118 -		{
   1.119  			LLMeshRepository::sHTTPRequestCount++;
   1.120  		}
   1.121  		count++;
   1.122 @@ -1435,10 +1401,6 @@
   1.123  			std::string http_url = constructUrl(mesh_id);
   1.124  			if (!http_url.empty())
   1.125  			{
   1.126 -#if 0
   1.127 -				retval = mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size,
   1.128 -										   new LLMeshLODResponder(mesh_params, lod, offset, size));
   1.129 -#else
   1.130  				LLMeshLODHandler * handler = new LLMeshLODHandler(mesh_params, lod, offset, size);
   1.131  				// LL_WARNS("Mesh") << "MESH:  Issuing LOD Request" << LL_ENDL;
   1.132  				LLCore::HttpHandle handle = mHttpRequest->requestGetByteRange(mHttpPolicyClass,
   1.133 @@ -1460,10 +1422,6 @@
   1.134  				{
   1.135  					handler->mHttpHandle = handle;
   1.136  					mHttpRequestSet.insert(handler);
   1.137 -				}
   1.138 -#endif
   1.139 -				if(retval)
   1.140 -				{
   1.141  					LLMeshRepository::sHTTPRequestCount++;
   1.142  				}
   1.143  				count++;

mercurial