From e38a676c087d0adce9bd35cf3bdf8ff0e898f201 Mon Sep 17 00:00:00 2001
From: Monty Brandenberg <monty@lindenlab.com>
Date: Tue, 3 Jul 2012 19:22:24 -0400
Subject: [PATCH] Add CURLE_SEND_ERROR and CURLE_RECV_ERROR to the set of
 retryable errors. Data problems after connections are established should be
 retried as well. Extend to appropriate libcurl codes.  Also allow our
 connectivity to drop to as low as a single connection when trying to recover.

---
 indra/llcorehttp/_httppolicy.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp
index 1b10805b725..1e649241988 100644
--- a/indra/llcorehttp/_httppolicy.cpp
+++ b/indra/llcorehttp/_httppolicy.cpp
@@ -46,7 +46,7 @@ struct HttpPolicy::State
 	State()
 		: mConnMax(DEFAULT_CONNECTIONS),
 		  mConnAt(DEFAULT_CONNECTIONS),
-		  mConnMin(2),
+		  mConnMin(1),
 		  mNextSample(0),
 		  mErrorCount(0),
 		  mErrorFactor(0)
@@ -303,6 +303,8 @@ bool HttpPolicy::stageAfterCompletion(HttpOpRequest * op)
 	static const HttpStatus cant_connect(HttpStatus::EXT_CURL_EASY, CURLE_COULDNT_CONNECT);
 	static const HttpStatus cant_res_proxy(HttpStatus::EXT_CURL_EASY, CURLE_COULDNT_RESOLVE_PROXY);
 	static const HttpStatus cant_res_host(HttpStatus::EXT_CURL_EASY, CURLE_COULDNT_RESOLVE_HOST);
+	static const HttpStatus send_error(HttpStatus::EXT_CURL_EASY, CURLE_SEND_ERROR);
+	static const HttpStatus recv_error(HttpStatus::EXT_CURL_EASY, CURLE_RECV_ERROR);
 
 	// Retry or finalize
 	if (! op->mStatus)
@@ -313,7 +315,9 @@ bool HttpPolicy::stageAfterCompletion(HttpOpRequest * op)
 			((op->mStatus.isHttpStatus() && op->mStatus.mType >= 499 && op->mStatus.mType <= 599) ||
 			 cant_connect == op->mStatus ||
 			 cant_res_proxy == op->mStatus ||
-			 cant_res_host == op->mStatus))
+			 cant_res_host == op->mStatus ||
+			 send_error == op->mStatus ||
+			 recv_error == op->mStatus))
 		{
 			// Okay, worth a retry.  We include 499 in this test as
 			// it's the old 'who knows?' error from many grid services...
-- 
GitLab