summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llappearancemgr.cpp3
-rwxr-xr-xindra/newview/llhttpretrypolicy.cpp7
-rwxr-xr-xindra/newview/llhttpretrypolicy.h3
-rwxr-xr-xindra/newview/tests/llhttpretrypolicy_test.cpp15
4 files changed, 19 insertions, 9 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 3c141aa37a..84a494186f 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2871,7 +2871,8 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder
public:
RequestAgentUpdateAppearanceResponder()
{
- mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10);
+ bool retry_on_4xx = true;
+ mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10, retry_on_4xx);
}
virtual ~RequestAgentUpdateAppearanceResponder()
diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp
index 80d97e4362..1512b46103 100755
--- a/indra/newview/llhttpretrypolicy.cpp
+++ b/indra/newview/llhttpretrypolicy.cpp
@@ -28,11 +28,12 @@
#include "llhttpretrypolicy.h"
-LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries):
+LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx):
mMinDelay(min_delay),
mMaxDelay(max_delay),
mBackoffFactor(backoff_factor),
- mMaxRetries(max_retries)
+ mMaxRetries(max_retries),
+ mRetryOn4xx(retry_on_4xx)
{
init();
}
@@ -108,7 +109,7 @@ void LLAdaptiveRetryPolicy::onFailureCommon(S32 status, bool has_retry_header_ti
llinfos << "Too many retries " << mRetryCount << ", will not retry" << llendl;
mShouldRetry = false;
}
- if (!isHttpServerErrorStatus(status))
+ if (!mRetryOn4xx && !isHttpServerErrorStatus(status))
{
llinfos << "Non-server error " << status << ", will not retry" << llendl;
mShouldRetry = false;
diff --git a/indra/newview/llhttpretrypolicy.h b/indra/newview/llhttpretrypolicy.h
index 1fb0cac03f..5b1a1d79e0 100755
--- a/indra/newview/llhttpretrypolicy.h
+++ b/indra/newview/llhttpretrypolicy.h
@@ -60,7 +60,7 @@ public:
class LLAdaptiveRetryPolicy: public LLHTTPRetryPolicy
{
public:
- LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries);
+ LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx = false);
// virtual
void onSuccess();
@@ -88,6 +88,7 @@ private:
U32 mRetryCount; // number of times shouldRetry has been called.
LLTimer mRetryTimer; // time until next retry.
bool mShouldRetry; // Becomes false after too many retries, or the wrong sort of status received, etc.
+ bool mRetryOn4xx; // Normally only retry on 5xx server errors.
};
#endif
diff --git a/indra/newview/tests/llhttpretrypolicy_test.cpp b/indra/newview/tests/llhttpretrypolicy_test.cpp
index ed7f3ba326..25e6de46d9 100755
--- a/indra/newview/tests/llhttpretrypolicy_test.cpp
+++ b/indra/newview/tests/llhttpretrypolicy_test.cpp
@@ -56,12 +56,19 @@ void RetryPolicyTestObject::test<1>()
template<> template<>
void RetryPolicyTestObject::test<2>()
{
- LLAdaptiveRetryPolicy retry404(1.0,2.0,3.0,10);
LLSD headers;
F32 wait_seconds;
-
- retry404.onFailure(404,headers);
- ensure("no retry on 404", !retry404.shouldRetry(wait_seconds));
+
+ // Normally only retry on server error (5xx)
+ LLAdaptiveRetryPolicy noRetry404(1.0,2.0,3.0,10);
+ noRetry404.onFailure(404,headers);
+ ensure("no retry on 404", !noRetry404.shouldRetry(wait_seconds));
+
+ // Can retry on 4xx errors if enabled by flag.
+ bool do_retry_4xx = true;
+ LLAdaptiveRetryPolicy doRetry404(1.0,2.0,3.0,10,do_retry_4xx);
+ doRetry404.onFailure(404,headers);
+ ensure("do retry on 404", doRetry404.shouldRetry(wait_seconds));
}
template<> template<>