AU: Handle inability to get proxy servers from Chrome better.
Rather than have the proxy resolve fail immediately if Chrome can't be
contacted, asynchronously return kNoProxy so that update will continue
w/o proxy servers. This makes the new Chrome Browser Proxy Resolver
behave like the other proxy resolvers.
BUG=chromium-os:13039
TEST=unittest; initctl stop ui; do an update
Review URL: http://codereview.chromium.org/6681042
Change-Id: I757df5e221ae3311f7d0f507fbf054176e3fa418
diff --git a/chrome_browser_proxy_resolver.cc b/chrome_browser_proxy_resolver.cc
index a481f4f..abfec16 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/chrome_browser_proxy_resolver.cc
@@ -128,8 +128,8 @@
ProxiesResolvedFn callback,
void* data) {
GError* error = NULL;
- TEST_AND_RETURN_FALSE(proxy_);
- if (!dbus_->ProxyCall(
+ guint timeout = timeout_;
+ if (!proxy_ || !dbus_->ProxyCall(
proxy_,
kLibCrosServiceResolveNetworkProxyMethodName,
&error,
@@ -137,15 +137,16 @@
G_TYPE_STRING, kLibCrosProxyResolveSignalInterface,
G_TYPE_STRING, kLibCrosProxyResolveName,
G_TYPE_INVALID, G_TYPE_INVALID)) {
- LOG(ERROR) << "dbus_g_proxy_call failed: "
- << utils::GetGErrorMessage(error);
- return false;
+ LOG(WARNING) << "dbus_g_proxy_call failed: "
+ << utils::GetGErrorMessage(error)
+ << " Continuing with no proxy.";
+ timeout = 0;
}
callbacks_.insert(make_pair(url, make_pair(callback, data)));
Closure* closure = NewCallback(this,
&ChromeBrowserProxyResolver::HandleTimeout,
url);
- GSource* timer = g_timeout_source_new_seconds(timeout_);
+ GSource* timer = g_timeout_source_new_seconds(timeout);
g_source_set_callback(timer, &utils::GlibRunClosure, closure, NULL);
g_source_attach(timer, NULL);
timers_.insert(make_pair(url, timer));