AU: When server dies, don't retry forever

BUG=4871
TEST=attached unittests

Review URL: http://codereview.chromium.org/3010009
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index fd55d8e..a7799cb 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -23,7 +23,7 @@
   LibcurlHttpFetcher()
       : curl_multi_handle_(NULL), curl_handle_(NULL),
         timeout_source_(NULL), transfer_in_progress_(false),
-        idle_ms_(1000) {}
+        retry_count_(0), idle_ms_(1000) {}
 
   // Cleans up all internal state. Does not notify delegate
   ~LibcurlHttpFetcher();
@@ -73,6 +73,11 @@
   static gboolean StaticTimeoutCallback(gpointer data) {
     return reinterpret_cast<LibcurlHttpFetcher*>(data)->TimeoutCallback();
   }
+  
+  gboolean RetryTimeoutCallback();
+  static gboolean StaticRetryTimeoutCallback(void* arg) {
+    return static_cast<LibcurlHttpFetcher*>(arg)->RetryTimeoutCallback();
+  }
 
   // Calls into curl_multi_perform to let libcurl do its work. Returns after
   // curl_multi_perform is finished, which may actually be after more than
@@ -123,6 +128,9 @@
   // If we resumed an earlier transfer, data offset that we used for the
   // new connection.  0 otherwise.
   off_t resume_offset_;
+  
+  // Number of resumes performed.
+  int retry_count_;
 
   long idle_ms_;
   DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher);