update_engine: NextPayload() resets URL index
This change fixes a bug/assumption that |PayloadState| used to make in
regards to URL index related to payloads. When a URL index is
incremented, there is no gurauntee that subsequent payloads will have
the same number of candidate URLs, hence it is critical to reset the URL
index back to 0 for subsequent payloads. This fix also allows candidate
URLs to not be skipped over for multi-package/payload request/responses.
The max number of times a URL is allowed to fail is reduced from 10 to 3
to allow preferred URLs to always be used as the intial URL for payloads.
BUG=chromium:928805
TEST=FEATURES=test emerge-$B update_engine # filter PayloadStateTest
Change-Id: I67732b2b7da08f580d1b554fd85eb06b3bf1f761
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2188552
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/omaha_request_action.h b/omaha_request_action.h
index 623a704..30b3d22 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -68,12 +68,12 @@
public HttpFetcherDelegate {
public:
static const int kPingTimeJump = -2;
- // We choose this value of 10 as a heuristic for a work day in trying
+ // We choose this value of 3 as a heuristic for a work day in trying
// each URL, assuming we check roughly every 45 mins. This is a good time to
- // wait - neither too long nor too little - so we don't give up the preferred
- // URLs that appear earlier in list too quickly before moving on to the
- // fallback ones.
- static const int kDefaultMaxFailureCountPerUrl = 10;
+ // wait so we don't give up the preferred URLs, but allow using the URL that
+ // appears earlier in list for every payload before resorting to the fallback
+ // URLs in the candiate URL list.
+ static const int kDefaultMaxFailureCountPerUrl = 3;
// If staging is enabled, set the maximum wait time to 28 days, since that is
// the predetermined wait time for staging.