summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpretrypolicy.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-11 16:17:23 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-11 16:17:23 -0400
commite17920defbf1d39ecd9e88500ba268c59bb84008 (patch)
treeb026ddc91431df37db101502c1d9185482b70978 /indra/llmessage/llhttpretrypolicy.cpp
parent14ca6a1247e68805aae22cf573a39819383fe3d4 (diff)
SH-4061 WIP - started adding retry to texture fetch, making retry policy compatible with old and new http libraries
Diffstat (limited to 'indra/llmessage/llhttpretrypolicy.cpp')
-rwxr-xr-xindra/llmessage/llhttpretrypolicy.cpp17
1 files changed, 14 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;
}