AU: minor fixes requested in http://codereview.chromium.org/3010009
These were too minor to fix at the time, since the CL was needed
urgently.
Review URL: http://codereview.chromium.org/3021003
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 84f0972..12b11a0 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -79,7 +79,7 @@
CleanUp();
}
-bool LibcurlHttpFetcher::CurlPerformOnce() {
+void LibcurlHttpFetcher::CurlPerformOnce() {
CHECK(transfer_in_progress_);
int running_handles = 0;
CURLMcode retcode = CURLM_CALL_MULTI_PERFORM;
@@ -116,7 +116,7 @@
&LibcurlHttpFetcher::StaticRetryTimeoutCallback,
this);
}
- return false;
+ return;
} else {
if (delegate_) {
// success is when http_response_code is 2xx
@@ -129,7 +129,6 @@
// set up callback
SetupMainloopSources();
}
- return false;
}
size_t LibcurlHttpFetcher::LibcurlWrite(void *ptr, size_t size, size_t nmemb) {
@@ -260,14 +259,11 @@
}
gboolean LibcurlHttpFetcher::TimeoutCallback() {
+ // We always return true, even if we don't want glib to call us back.
+ // We will remove the event source separately if we don't want to
+ // be called back.
if (!transfer_in_progress_)
return TRUE;
- // Since we will return false from this function, which tells glib to
- // destroy the timeout callback, we must NULL it out here. This way, when
- // setting up callback sources again, we won't try to delete this (doomed)
- // timeout callback then.
- // TODO(adlr): optimize by checking if we can keep this timeout callback.
- //timeout_source_ = NULL;
CurlPerformOnce();
return TRUE;
}
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index a7799cb..b0cac28 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -85,7 +85,7 @@
// loop with sources for future work that libcurl will do.
// This method will not block.
// Returns true if we should resume immediately after this call.
- bool CurlPerformOnce();
+ void CurlPerformOnce();
// Sets up glib main loop sources as needed by libcurl. This is generally
// the file descriptor of the socket and a timer in case nothing happens