diff --git a/http_fetcher_unittest.cc b/http_fetcher_unittest.cc
index 2b2e2cb..17e359e 100644
--- a/http_fetcher_unittest.cc
+++ b/http_fetcher_unittest.cc
@@ -122,7 +122,9 @@
  public:
   HttpFetcher* NewLargeFetcher() {
     LibcurlHttpFetcher *ret = new LibcurlHttpFetcher;
-    ret->set_idle_ms(1000);  // speeds up test execution
+    // Speed up test execution.
+    ret->set_idle_seconds(1);
+    ret->set_retry_seconds(1);
     return ret;
   }
   HttpFetcher* NewSmallFetcher() {
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 0707d99..f636764 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -112,7 +112,7 @@
         if (delegate_)
           delegate_->TransferComplete(this, false);  // success
       } else {
-        g_timeout_add_seconds(5,
+        g_timeout_add_seconds(retry_seconds_,
                               &LibcurlHttpFetcher::StaticRetryTimeoutCallback,
                               this);
       }
@@ -216,29 +216,12 @@
     }
   }
 
-  // Wet up a timeout callback for libcurl
-  long ms = 0;
-  CHECK_EQ(curl_multi_timeout(curl_multi_handle_, &ms), CURLM_OK);
-  if (ms < 0) {
-    // From http://curl.haxx.se/libcurl/c/curl_multi_timeout.html:
-    //     if libcurl returns a -1 timeout here, it just means that libcurl
-    //     currently has no stored timeout value. You must not wait too long
-    //     (more than a few seconds perhaps) before you call
-    //     curl_multi_perform() again.
-    ms = idle_ms_;
-  }
+  // Set up a timeout callback for libcurl.
   if (!timeout_source_) {
-    LOG(INFO) << "setting up timeout source:" << ms;
-    timeout_source_ = g_timeout_source_new_seconds(1);
-    CHECK(timeout_source_);
-    g_source_set_callback(timeout_source_, StaticTimeoutCallback, this,
-                          NULL);
+    LOG(INFO) << "Setting up timeout source: " << idle_seconds_ << " seconds.";
+    timeout_source_ = g_timeout_source_new_seconds(idle_seconds_);
+    g_source_set_callback(timeout_source_, StaticTimeoutCallback, this, NULL);
     g_source_attach(timeout_source_, NULL);
-    static int counter = 0;
-    counter++;
-    if (counter % 50 == 0) {
-      LOG(INFO) << "counter = " << counter;
-    }
   }
 }
 
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index 66c1117..a4ed52f 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -21,9 +21,13 @@
 class LibcurlHttpFetcher : public HttpFetcher {
  public:
   LibcurlHttpFetcher()
-      : curl_multi_handle_(NULL), curl_handle_(NULL),
-        timeout_source_(NULL), transfer_in_progress_(false),
-        retry_count_(0), idle_ms_(1000) {}
+      : curl_multi_handle_(NULL),
+        curl_handle_(NULL),
+        timeout_source_(NULL),
+        transfer_in_progress_(false),
+        retry_count_(0),
+        retry_seconds_(60),
+        idle_seconds_(1) {}
 
   // Cleans up all internal state. Does not notify delegate
   ~LibcurlHttpFetcher();
@@ -50,9 +54,11 @@
   //     currently has no stored timeout value. You must not wait too long
   //     (more than a few seconds perhaps) before you call
   //     curl_multi_perform() again.
-  void set_idle_ms(long ms) {
-    idle_ms_ = ms;
-  }
+  void set_idle_seconds(int seconds) { idle_seconds_ = seconds; }
+
+  // Sets the retry timeout. Useful for testing.
+  void set_retry_seconds(int seconds) { retry_seconds_ = seconds; }
+
  private:
   // Resumes a transfer where it left off. This will use the
   // HTTP Range: header to make a new connection from where the last
@@ -73,7 +79,7 @@
   static gboolean StaticTimeoutCallback(gpointer data) {
     return reinterpret_cast<LibcurlHttpFetcher*>(data)->TimeoutCallback();
   }
-  
+
   gboolean RetryTimeoutCallback();
   static gboolean StaticRetryTimeoutCallback(void* arg) {
     return static_cast<LibcurlHttpFetcher*>(arg)->RetryTimeoutCallback();
@@ -128,11 +134,16 @@
   // 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_;
+  // Seconds to wait before retrying a resume.
+  int retry_seconds_;
+
+  // Seconds to wait before asking libcurl to "perform".
+  int idle_seconds_;
+
   DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher);
 };
 
