Classify errors and advance URL index according to the error code.
In CL https://gerrit.chromium.org/gerrit/39638, we always incremented
the URL index irrespective of the error code. That would cause the first
URL to be given up too quickly in favor of the second one even for
transient errors such as when user closes a lid and reopens after some
time.
The right behavior in this case is to just count those failures towards
the URL and only after repeated failures with no progress should we
advance the URL index.
This CL implements this logic and completes the multiple URL-related
work items outlined in the design doc.
BUG=chromium-os:37206
TEST=Tested all uses cases on my ZGB. Added and updated unit tests.
Change-Id: Ida0cfbfeb9bfab732144049d1b27e3b8958bc252
Reviewed-on: https://gerrit.chromium.org/gerrit/39885
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/prefs_interface.h b/prefs_interface.h
index cc7c4d1..7bc56ca 100644
--- a/prefs_interface.h
+++ b/prefs_interface.h
@@ -27,8 +27,10 @@
extern const char kPrefsUpdateCheckCount[];
extern const char kPrefsWallClockWaitPeriod[];
extern const char kPrefsUpdateFirstSeenAt[];
+extern const char kPrefsPayloadAttemptNumber[];
extern const char kPrefsCurrentResponse[];
extern const char kPrefsCurrentUrlIndex[];
+extern const char kPrefsCurrentUrlFailureCount[];
// The prefs interface allows access to a persistent preferences
// store. The two reasons for providing this as an interface are