Index: net/base/dnsrr_resolver.cc |
diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc |
index cfe63e2bba53854e18a8bbd26fe07d5156225a6f..3fecfe332acdd72348836ed4c418ab7a223289b4 100644 |
--- a/net/base/dnsrr_resolver.cc |
+++ b/net/base/dnsrr_resolver.cc |
@@ -509,11 +509,7 @@ class RRResolverJob { |
} |
~RRResolverJob() { |
- if (worker_) { |
- worker_->Cancel(); |
- worker_ = NULL; |
- PostAll(ERR_ABORTED, NULL); |
- } |
+ Cancel(ERR_ABORTED); |
} |
void AddHandle(RRResolverHandle* handle) { |
@@ -525,6 +521,14 @@ class RRResolverJob { |
PostAll(result, &response); |
} |
+ void Cancel(int result) { |
+ if (worker_) { |
+ worker_->Cancel(); |
+ worker_ = NULL; |
+ PostAll(result, NULL); |
+ } |
+ } |
+ |
private: |
void PostAll(int result, const RRResponse* response) { |
std::vector<RRResolverHandle*> handles; |
@@ -643,6 +647,9 @@ void DnsRRResolver::OnIPAddressChanged() { |
inflight.swap(inflight_); |
cache_.clear(); |
+ std::map<std::pair<std::string, uint16>, RRResolverJob*>::iterator it; |
+ for (it = inflight.begin(); it != inflight.end(); ++it) |
+ it->second->Cancel(ERR_NETWORK_CHANGED); |
STLDeleteValues(&inflight); |
} |