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

Side by Side Diff: net/dns/host_resolver_mojo.cc

Issue 1908543002: DNS: Retain stale entries in HostCache and return when requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, make all members of Entry private Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/host_resolver_mojo.h" 5 #include "net/dns/host_resolver_mojo.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 const HostCache::Key& key, 112 const HostCache::Key& key,
113 AddressList* addresses) { 113 AddressList* addresses) {
114 if (!info.allow_cached_response()) 114 if (!info.allow_cached_response())
115 return ERR_DNS_CACHE_MISS; 115 return ERR_DNS_CACHE_MISS;
116 116
117 const HostCache::Entry* entry = 117 const HostCache::Entry* entry =
118 host_cache_->Lookup(key, base::TimeTicks::Now()); 118 host_cache_->Lookup(key, base::TimeTicks::Now());
119 if (!entry) 119 if (!entry)
120 return ERR_DNS_CACHE_MISS; 120 return ERR_DNS_CACHE_MISS;
121 121
122 *addresses = AddressList::CopyWithPort(entry->addrlist, info.port()); 122 *addresses = AddressList::CopyWithPort(entry->addresses(), info.port());
123 return entry->error; 123 return entry->error();
124 } 124 }
125 125
126 HostResolverMojo::Job::Job( 126 HostResolverMojo::Job::Job(
127 const HostCache::Key& key, 127 const HostCache::Key& key,
128 AddressList* addresses, 128 AddressList* addresses,
129 const CompletionCallback& callback, 129 const CompletionCallback& callback,
130 mojo::InterfaceRequest<interfaces::HostResolverRequestClient> request, 130 mojo::InterfaceRequest<interfaces::HostResolverRequestClient> request,
131 base::WeakPtr<HostCache> host_cache) 131 base::WeakPtr<HostCache> host_cache)
132 : key_(key), 132 : key_(key),
133 addresses_(addresses), 133 addresses_(addresses),
(...skipping 17 matching lines...) Expand all
151 } 151 }
152 callback_.Run(error); 152 callback_.Run(error);
153 delete this; 153 delete this;
154 } 154 }
155 155
156 void HostResolverMojo::Job::OnConnectionError() { 156 void HostResolverMojo::Job::OnConnectionError() {
157 ReportResult(ERR_FAILED, interfaces::AddressListPtr()); 157 ReportResult(ERR_FAILED, interfaces::AddressListPtr());
158 } 158 }
159 159
160 } // namespace net 160 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698