diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/llmessage/llhttpretrypolicy.cpp | 17 | ||||
| -rwxr-xr-x | indra/llmessage/llhttpretrypolicy.h | 17 | ||||
| -rwxr-xr-x | indra/newview/lltexturefetch.cpp | 1 | ||||
| -rwxr-xr-x | indra/newview/lltexturefetch.h | 3 | 
4 files changed, 35 insertions, 3 deletions
| diff --git a/indra/llmessage/llhttpretrypolicy.cpp b/indra/llmessage/llhttpretrypolicy.cpp index 23d9e64c13..7e4dfc7250 100755 --- a/indra/llmessage/llhttpretrypolicy.cpp +++ b/indra/llmessage/llhttpretrypolicy.cpp @@ -27,8 +27,21 @@  #include "linden_common.h"  #include "llhttpretrypolicy.h" +bool LLAdaptiveRetryPolicy::getRetryAfter(const LLSD& headers, retry_header_time) +{ +	return (headers.has(HTTP_IN_HEADER_RETRY_AFTER) +			&& getSecondsUntilRetryAfter(headers[HTTP_IN_HEADER_RETRY_AFTER].asStringRef(), retry_header_time)); +} +  void LLAdaptiveRetryPolicy::onFailure(S32 status, const LLSD& headers)  { +	F32 retry_header_time; +	bool has_retry_header_time = getRetryAfter(headers,retry_header_time); +	onFailureCommon(status, has_retry_header_time, retry_header_time); +} + +void LLAdaptiveRetryPolicy::onFailureCommon(S32 status, bool has_retry_header_time, F32 retry_header_time) +{  	if (mRetryCount > 0)  	{  		mDelay = llclamp(mDelay*mBackoffFactor,mMinDelay,mMaxDelay); @@ -36,9 +49,7 @@ void LLAdaptiveRetryPolicy::onFailure(S32 status, const LLSD& headers)  	// Honor server Retry-After header.  	// Status 503 may ask us to wait for a certain amount of time before retrying.  	F32 wait_time = mDelay; -	F32 retry_header_time; -	if (headers.has(HTTP_IN_HEADER_RETRY_AFTER) -		&& getSecondsUntilRetryAfter(headers[HTTP_IN_HEADER_RETRY_AFTER].asStringRef(), retry_header_time)) +	if (has_retry_header_time)  	{  		wait_time = retry_header_time;  	} diff --git a/indra/llmessage/llhttpretrypolicy.h b/indra/llmessage/llhttpretrypolicy.h index f2eba0965b..cf27bb3048 100755 --- a/indra/llmessage/llhttpretrypolicy.h +++ b/indra/llmessage/llhttpretrypolicy.h @@ -29,8 +29,13 @@  #include "lltimer.h"  #include "llthread.h" +  #include "llhttpconstants.h" +// For compatibility with new core http lib. +#include "httpresponse.h" +#include "httpheaders.h" +  // This is intended for use with HTTP Clients/Responders, but is not  // specifically coupled with those classes.  class LLHTTPRetryPolicy: public LLThreadSafeRefCount @@ -40,6 +45,9 @@ public:  	virtual ~LLHTTPRetryPolicy() {}  	// Call once after an HTTP failure to update state.  	virtual void onFailure(S32 status, const LLSD& headers) = 0; + +	virtual void onFailure(const HttpResponse *response, const HttpHeaders *headers) = 0; +  	virtual bool shouldRetry(F32& seconds_to_wait) const = 0;  }; @@ -59,10 +67,19 @@ public:  	{  	} +	// virtual  	void onFailure(S32 status, const LLSD& headers); +	// virtual +	void onFailure(const HttpResponse *response, const HttpHeaders *headers); +	// virtual  	bool shouldRetry(F32& seconds_to_wait) const; +protected: +	bool getRetryAfter(const LLSD& headers, retry_header_time) +	void onFailureCommon(S32 status, bool has_retry_header_time, F32 retry_header_time); +  private: +  	F32 mMinDelay; // delay never less than this value  	F32 mMaxDelay; // delay never exceeds this value  	F32 mBackoffFactor; // delay increases by this factor after each retry, up to mMaxDelay. diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 58cfc80839..026f36e205 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1918,6 +1918,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe  						 << " status: " << status.toHex()  						 << " '" << status.toString() << "'"  						 << llendl; +  //	unsigned int offset(0), length(0), full_length(0);  //	response->getRange(&offset, &length, &full_length);  // 	llwarns << "HTTP COMPLETE: " << mID << " handle: " << handle diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 9f77d58727..c6bd342a7b 100755 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -396,6 +396,9 @@ private:  	e_tex_source mFetchSource;  	e_tex_source mOriginFetchSource; +	// Retry logic +	LLAdaptiveRetryPolicy mFetchRetryPolicy; +	  public:  	//debug use  	LLTextureFetchDebugger* getFetchDebugger() { return mFetchDebugger;} | 
