| Index: net/base/host_resolver_impl.cc
|
| diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
|
| index 217f1e1329e678e0500a337fbc45cf9a33e165e1..a3b3685f742b01b16dc0f830d6081a266a6dfe79 100644
|
| --- a/net/base/host_resolver_impl.cc
|
| +++ b/net/base/host_resolver_impl.cc
|
| @@ -50,6 +50,9 @@ namespace {
|
| // some platform's resolvers.
|
| const size_t kMaxHostLength = 4096;
|
|
|
| +// Default TTL for successful resolutions with ProcTask.
|
| +const unsigned kCacheEntryTTLSeconds = 60;
|
| +
|
| // Helper to mutate the linked list contained by AddressList to the given
|
| // port. Note that in general this is dangerous since the AddressList's
|
| // data might be shared (and you should use AddressList::SetPort).
|
| @@ -1353,9 +1356,14 @@ void HostResolverImpl::OnJobComplete(Job* job,
|
| RemoveOutstandingJob(job);
|
|
|
| // Write result to the cache.
|
| - if (cache_.get())
|
| - cache_->Set(job->key(), net_error, addrlist, base::TimeTicks::Now());
|
| -
|
| + if (cache_.get()) {
|
| + base::TimeDelta ttl = base::TimeDelta::FromSeconds(0);
|
| + if (net_error == OK)
|
| + ttl = base::TimeDelta::FromSeconds(kCacheEntryTTLSeconds);
|
| + cache_->Set(job->key(), net_error, addrlist,
|
| + base::TimeTicks::Now(),
|
| + ttl);
|
| + }
|
| OnJobCompleteInternal(job, net_error, os_error, addrlist);
|
| }
|
|
|
|
|