Chromium Code Reviews| 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..94d6aa72510713fad7562cd8417ef467d6ec0412 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 base::TimeDelta kCacheEntryTTL = base::TimeDelta::FromMinutes(1); |
|
mmenke
2012/01/20 22:02:16
The constants up here should just be the times as
|
| + |
| // 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 = kCacheEntryTTL; |
| + cache_->Set(job->key(), net_error, addrlist, |
| + base::TimeTicks::Now(), |
| + ttl); |
| + } |
| OnJobCompleteInternal(job, net_error, os_error, addrlist); |
| } |