| Index: http_fetcher.cc
|
| diff --git a/http_fetcher.cc b/http_fetcher.cc
|
| index 5d006607c6e3697fc29db2edefe867581d9803bd..7d9297a5048938fc8b2e6e11b9cc15fcde14e6a9 100644
|
| --- a/http_fetcher.cc
|
| +++ b/http_fetcher.cc
|
| @@ -4,11 +4,19 @@
|
|
|
| #include "update_engine/http_fetcher.h"
|
|
|
| +using google::protobuf::Closure;
|
| using std::deque;
|
| using std::string;
|
|
|
| namespace chromeos_update_engine {
|
|
|
| +HttpFetcher::~HttpFetcher() {
|
| + if (no_resolver_idle_id_) {
|
| + g_source_remove(no_resolver_idle_id_);
|
| + no_resolver_idle_id_ = 0;
|
| + }
|
| +}
|
| +
|
| void HttpFetcher::SetPostData(const void* data, size_t size) {
|
| post_data_set_ = true;
|
| post_data_.clear();
|
| @@ -17,15 +25,24 @@ void HttpFetcher::SetPostData(const void* data, size_t size) {
|
| }
|
|
|
| // Proxy methods to set the proxies, then to pop them off.
|
| -void HttpFetcher::ResolveProxiesForUrl(const string& url) {
|
| +bool HttpFetcher::ResolveProxiesForUrl(const string& url, Closure* callback) {
|
| if (!proxy_resolver_) {
|
| LOG(INFO) << "Not resolving proxies (no proxy resolver).";
|
| - return;
|
| + no_resolver_idle_id_ = g_idle_add(utils::GlibRunClosure, callback);
|
| + return true;
|
| }
|
| - deque<string> proxies;
|
| - if (proxy_resolver_->GetProxiesForUrl(url, &proxies)) {
|
| + callback_ = callback;
|
| + return proxy_resolver_->GetProxiesForUrl(url,
|
| + &HttpFetcher::StaticProxiesResolved,
|
| + this);
|
| +}
|
| +
|
| +void HttpFetcher::ProxiesResolved(const std::deque<std::string>& proxies) {
|
| + no_resolver_idle_id_ = 0;
|
| + if (!proxies.empty())
|
| SetProxies(proxies);
|
| - }
|
| + callback_->Run();
|
| + callback_ = NULL;
|
| }
|
|
|
| } // namespace chromeos_update_engine
|
|
|