Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: net/base/host_resolver_impl.cc

Issue 3036011: [Linux] Enable connecting to localhost when offline. (Closed)
Patch Set: Address comments Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/host_resolver_impl.cc
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index ffba57f8834003f3fd684acd0762f67bc5ae7e09..0f2e5f069e0a9a46219d867a995a7f1eb90e0d4e 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -715,7 +715,8 @@ HostResolverImpl::HostResolverImpl(
resolver_proc_(resolver_proc),
default_address_family_(ADDRESS_FAMILY_UNSPECIFIED),
shutdown_(false),
- ipv6_probe_monitoring_(false) {
+ ipv6_probe_monitoring_(false),
+ additional_resolver_flags_(0) {
DCHECK_GT(max_jobs, 0u);
// It is cumbersome to expose all of the constraints in the constructor,
@@ -725,6 +726,10 @@ HostResolverImpl::HostResolverImpl(
#if defined(OS_WIN)
EnsureWinsockInit();
#endif
+#if defined(OS_LINUX)
+ if (HaveOnlyLoopbackAddresses())
eroman 2010/07/23 00:47:49 FYI: be aware this might cause a startup test regr
+ additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
+#endif
NetworkChangeNotifier::AddObserver(this);
}
@@ -1054,6 +1059,13 @@ void HostResolverImpl::OnIPAddressChanged() {
ipv6_probe_job_ = new IPv6ProbeJob(this);
ipv6_probe_job_->Start();
}
+#if defined(OS_LINUX)
eroman 2010/07/23 00:57:50 Should we enable this on mac as well?
+ if (HaveOnlyLoopbackAddresses()) {
+ additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
+ } else {
+ additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY;
+ }
+#endif
}
void HostResolverImpl::DiscardIPv6ProbeJob() {
@@ -1124,7 +1136,7 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
if (effective_address_family == ADDRESS_FAMILY_UNSPECIFIED)
effective_address_family = default_address_family_;
return Key(info.hostname(), effective_address_family,
- info.host_resolver_flags());
+ info.host_resolver_flags() | additional_resolver_flags_);
}
HostResolverImpl::Job* HostResolverImpl::CreateAndStartJob(Request* req) {

Powered by Google App Engine
This is Rietveld 408576698