p2p: Make HTTP downloads fail fast if using p2p to download

Failing fast when downloading via p2p is desirable because if we're
disconnected from the peer we're downloading from, chances are good
that it's not coming back. For example the peer could have gone to
sleep (user shutting the lid) or gone out of range. This is unlike the
non-p2p path where we can assume much better connectivity.

Also introduce new constants instead of hard-coded numbers and move
some existing constants to constants.h.

BUG=chromium:260426
TEST=Unit tests pass
Change-Id: Id2f1d0c60907caec06c4bdff3c70871d9f3eb20d
Reviewed-on: https://chromium-review.googlesource.com/64830
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/multi_range_http_fetcher.h b/multi_range_http_fetcher.h
index 5251bfe..652d0cb 100644
--- a/multi_range_http_fetcher.h
+++ b/multi_range_http_fetcher.h
@@ -90,6 +90,18 @@
     return base_fetcher_->GetBytesDownloaded();
   }
 
+  virtual void set_low_speed_limit(int low_speed_bps, int low_speed_sec) {
+    base_fetcher_->set_low_speed_limit(low_speed_bps, low_speed_sec);
+  }
+
+  virtual void set_connect_timeout(int connect_timeout_seconds) {
+    base_fetcher_->set_connect_timeout(connect_timeout_seconds);
+  }
+
+  virtual void set_max_retry_count(int max_retry_count) {
+    base_fetcher_->set_max_retry_count(max_retry_count);
+  }
+
  private:
   // A range object defining the offset and length of a download chunk.  Zero
   // length indicates an unspecified end offset (note that it is impossible to