Bugfix for HTTP textures trying to load forever if server is overloaded (Status code 503) from Henri Beauchamp (Cool VL)

Tue, 27 Dec 2011 12:38:49 +0100

author
Ansariel
date
Tue, 27 Dec 2011 12:38:49 +0100
changeset 1613
2615ecde1159
parent 1612
a4e050c55225
child 1614
b6ad16cb1945

Bugfix for HTTP textures trying to load forever if server is overloaded (Status code 503) from Henri Beauchamp (Cool VL)

indra/newview/lltexturefetch.cpp file | annotate | diff | revisions
indra/newview/llworld.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/lltexturefetch.cpp	Tue Dec 27 12:37:26 2011 +0100
     1.2 +++ b/indra/newview/lltexturefetch.cpp	Tue Dec 27 12:38:49 2011 +0100
     1.3 @@ -922,7 +922,7 @@
     1.4  			{
     1.5  				llwarns << "HTTP GET request failed for " << mID << llendl;
     1.6  				resetFormattedData();
     1.7 -				++mHTTPFailCount;
     1.8 +				mHTTPFailCount++;
     1.9  				return true; // failed
    1.10  			}
    1.11  			// fall through
    1.12 @@ -940,15 +940,17 @@
    1.13  			S32 cur_size = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
    1.14  			if (mRequestedSize < 0)
    1.15  			{
    1.16 -				S32 max_attempts;
    1.17 +				const S32 HTTP_MAX_RETRY_COUNT = 4;
    1.18 +				S32 max_attempts = HTTP_MAX_RETRY_COUNT;
    1.19  				if (mGetStatus == HTTP_NOT_FOUND)
    1.20  				{
    1.21 -					mHTTPFailCount = max_attempts = 1; // Don't retry
    1.22 +					mHTTPFailCount++;
    1.23 +					max_attempts = 1; // Don't retry
    1.24  					llwarns << "Texture missing from server (404): " << mUrl << llendl;
    1.25  
    1.26  					//roll back to try UDP
    1.27 -					if(mCanUseNET)
    1.28 -				{
    1.29 +					if (mCanUseNET)
    1.30 +					{
    1.31  						llinfos << "Falling back to UDP fetch for texture " << mID << llendl;
    1.32  						mState = INIT ;
    1.33  						mCanUseHTTP = false ;
    1.34 @@ -965,21 +967,22 @@
    1.35  				}
    1.36  				else if (mGetStatus == HTTP_SERVICE_UNAVAILABLE)
    1.37  				{
    1.38 -					// *TODO: Should probably introduce a timer here to delay future HTTP requsts
    1.39 +					// *TODO: Should probably introduce a timer here to delay future HTTP requests
    1.40  					// for a short time (~1s) to ease server load? Ideally the server would queue
    1.41  					// requests instead of returning 503... we already limit the number pending.
    1.42 -					++mHTTPFailCount;
    1.43 -					max_attempts = mHTTPFailCount+1; // Keep retrying
    1.44 -					LL_INFOS_ONCE("Texture") << "Texture server busy (503): " << mUrl << LL_ENDL;
    1.45 +					mHTTPFailCount++;
    1.46 +					llinfos << "Texture server busy (503): " << mUrl
    1.47 +							<< " Attempt:" << mHTTPFailCount
    1.48 +							<< "/" << max_attempts << llendl;
    1.49  				}
    1.50  				else
    1.51  					{
    1.52 -					const S32 HTTP_MAX_RETRY_COUNT = 3;
    1.53 -					max_attempts = HTTP_MAX_RETRY_COUNT + 1;
    1.54 -					++mHTTPFailCount;
    1.55 +					mHTTPFailCount++;
    1.56  					llinfos << "HTTP GET failed for: " << mUrl
    1.57 -							<< " Status: " << mGetStatus << " Reason: '" << mGetReason << "'"
    1.58 -							<< " Attempt:" << mHTTPFailCount+1 << "/" << max_attempts << llendl;
    1.59 +							<< " Status: " << mGetStatus
    1.60 +							<< " Reason: '" << mGetReason << "'"
    1.61 +							<< " Attempt:" << mHTTPFailCount
    1.62 +							<< "/" << max_attempts << llendl;
    1.63  				}
    1.64  
    1.65  				if (mHTTPFailCount >= max_attempts)
     2.1 --- a/indra/newview/llworld.cpp	Tue Dec 27 12:37:26 2011 +0100
     2.2 +++ b/indra/newview/llworld.cpp	Tue Dec 27 12:38:49 2011 +0100
     2.3 @@ -1317,7 +1317,7 @@
     2.4  	U32 circuit_code = msg->getOurCircuitCode();
     2.5  	static U32 last_ip_u32 = 0;
     2.6  	static U32 last_circuit_code = 0;
     2.7 -	if (ip_u32 != last_ip_u32 || circuit_code != circuit_code)
     2.8 +	if (ip_u32 != last_ip_u32 || circuit_code != last_circuit_code)
     2.9  	{
    2.10  		last_ip_u32 = ip_u32;
    2.11  		last_circuit_code = circuit_code;

mercurial