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 11464028: Introduce ERR_NETWORK_CHANGED and allow URLFetcher to automatically retry on that error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, post first try if online, more tests Created 8 years 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 b56524ca8ad73ad438b63833e55710d03abeac20..2d546c548221b2ad80df5760eac3c3847455541c 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1269,9 +1269,9 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job {
// Called from AbortAllInProgressJobs. Completes all requests as aborted
// and destroys the job.
- void Abort() {
+ void Abort(int error) {
DCHECK(is_running());
- CompleteRequestsWithError(ERR_ABORTED);
+ CompleteRequestsWithError(error);
szym 2012/12/10 18:36:31 The only changes needed in host_resolver_impl.{h,c
Joao da Silva 2012/12/11 13:36:43 Done.
}
// If DnsTask present, abort it and fall back to ProcTask.
@@ -1532,6 +1532,7 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job {
}
bool did_complete = (entry.error != ERR_ABORTED) &&
+ (entry.error != ERR_NETWORK_CHANGED) &&
szym 2012/12/10 18:36:31 (2) change ERR_ABORTED to ERR_NETWORK_CHANGED here
Joao da Silva 2012/12/11 13:36:43 Done.
(entry.error != ERR_HOST_RESOLVER_QUEUE_TOO_LARGE);
if (did_complete)
resolver_->CacheResult(key_, entry, ttl);
@@ -2032,7 +2033,7 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
return Key(info.hostname(), effective_address_family, effective_flags);
}
-void HostResolverImpl::AbortAllInProgressJobs() {
+void HostResolverImpl::AbortAllInProgressJobs(int error) {
// In Abort, a Request callback could spawn new Jobs with matching keys, so
// first collect and remove all running jobs from |jobs_|.
ScopedVector<Job> jobs_to_abort;
@@ -2055,7 +2056,7 @@ void HostResolverImpl::AbortAllInProgressJobs() {
// Then Abort them.
for (size_t i = 0; self && i < jobs_to_abort.size(); ++i) {
- jobs_to_abort[i]->Abort();
+ jobs_to_abort[i]->Abort(error);
jobs_to_abort[i] = NULL;
}
}
@@ -2088,7 +2089,7 @@ void HostResolverImpl::OnIPAddressChanged() {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
new LoopbackProbeJob(probe_weak_ptr_factory_.GetWeakPtr());
#endif
- AbortAllInProgressJobs();
+ AbortAllInProgressJobs(ERR_NETWORK_CHANGED);
// |this| may be deleted inside AbortAllInProgressJobs().
}
@@ -2126,7 +2127,7 @@ void HostResolverImpl::OnDNSChanged() {
// Existing jobs will have been sent to the original server so they need to
// be aborted.
- AbortAllInProgressJobs();
+ AbortAllInProgressJobs(ERR_NETWORK_CHANGED);
// |this| may be deleted inside AbortAllInProgressJobs().
if (self)

Powered by Google App Engine
This is Rietveld 408576698