| Index: net/dns/async_host_resolver.cc
|
| diff --git a/net/dns/async_host_resolver.cc b/net/dns/async_host_resolver.cc
|
| index 6f6552bcfa684a7c680c9076ef19733c45e9918c..9c4fcabc6a6c7263f6f71a999e3c71c0f91ecfed 100644
|
| --- a/net/dns/async_host_resolver.cc
|
| +++ b/net/dns/async_host_resolver.cc
|
| @@ -75,7 +75,7 @@ HostResolver* CreateAsyncHostResolver(size_t max_concurrent_resolves,
|
| max_dns_requests,
|
| max_pending_requests,
|
| HostCache::CreateDefaultCache(),
|
| - DnsClient::CreateClient(session),
|
| + DnsTransactionFactory::CreateFactory(session),
|
| net_log);
|
| return resolver;
|
| }
|
| @@ -106,9 +106,8 @@ class AsyncHostResolver::Request {
|
| DCHECK(addresses_);
|
| DCHECK(resolver_);
|
| resolver_->OnStart(this);
|
| - std::string dns_name;
|
| - if (DNSDomainFromDot(info.hostname(), &dns_name))
|
| - key_ = Key(dns_name, QueryTypeFromAddressFamily(info.address_family()));
|
| + key_ = Key(info.hostname(),
|
| + QueryTypeFromAddressFamily(info.address_family()));
|
| }
|
|
|
| ~Request() {
|
| @@ -205,12 +204,12 @@ class AsyncHostResolver::Request {
|
| AsyncHostResolver::AsyncHostResolver(size_t max_dns_requests,
|
| size_t max_pending_requests,
|
| HostCache* cache,
|
| - DnsClient* client,
|
| + scoped_ptr<DnsTransactionFactory> client,
|
| NetLog* net_log)
|
| : max_dns_requests_(max_dns_requests),
|
| max_pending_requests_(max_pending_requests),
|
| cache_(cache),
|
| - client_(client),
|
| + client_(client.Pass()),
|
| net_log_(net_log) {
|
| }
|
|
|
| @@ -332,11 +331,11 @@ HostCache* AsyncHostResolver::GetHostCache() {
|
| return cache_.get();
|
| }
|
|
|
| -void AsyncHostResolver::OnDnsRequestComplete(
|
| - DnsClient::Request* dns_req,
|
| +void AsyncHostResolver::OnDnsTransactionComplete(
|
| + DnsTransaction* transaction,
|
| int result,
|
| const DnsResponse* response) {
|
| - DCHECK(std::find(dns_requests_.begin(), dns_requests_.end(), dns_req)
|
| + DCHECK(std::find(dns_requests_.begin(), dns_requests_.end(), transaction)
|
| != dns_requests_.end());
|
|
|
| // If by the time requests that caused |dns_req| are cancelled, we do
|
| @@ -344,7 +343,7 @@ void AsyncHostResolver::OnDnsRequestComplete(
|
| // assume the most common port, otherwise we use the port number of the
|
| // first request.
|
| KeyRequestListMap::iterator rit = requestlist_map_.find(
|
| - std::make_pair(dns_req->qname(), dns_req->qtype()));
|
| + std::make_pair(transaction->GetHostname(), transaction->GetType()));
|
| DCHECK(rit != requestlist_map_.end());
|
| RequestList& requests = rit->second;
|
| int port = requests.empty() ? 80 : requests.front()->info().port();
|
| @@ -357,7 +356,7 @@ void AsyncHostResolver::OnDnsRequestComplete(
|
| DnsResourceRecord record;
|
| // TODO(szym): Add stricter checking of names, aliases and address lengths.
|
| while (parser.ParseRecord(&record)) {
|
| - if (record.type == dns_req->qtype() &&
|
| + if (record.type == transaction->GetType() &&
|
| (record.rdata.size() == kIPv4AddressSize ||
|
| record.rdata.size() == kIPv6AddressSize)) {
|
| ip_addresses.push_back(IPAddressNumber(record.rdata.begin(),
|
| @@ -397,8 +396,8 @@ void AsyncHostResolver::OnDnsRequestComplete(
|
| requestlist_map_.erase(rit);
|
|
|
| // Cleanup |dns_req| and start a new one if there are pending requests.
|
| - dns_requests_.remove(dns_req);
|
| - delete dns_req;
|
| + dns_requests_.remove(transaction);
|
| + delete transaction;
|
| ProcessPending();
|
| }
|
|
|
| @@ -429,14 +428,16 @@ int AsyncHostResolver::StartNewDnsRequestFor(Request* request) {
|
| NetLog::TYPE_ASYNC_HOST_RESOLVER_CREATE_DNS_TRANSACTION, NULL);
|
|
|
| requestlist_map_[request->key()].push_back(request);
|
| - DnsClient::Request* dns_req = client_->CreateRequest(
|
| + scoped_ptr<DnsTransaction> dns_req = client_->CreateTransaction(
|
| request->key().first,
|
| request->key().second,
|
| - base::Bind(&AsyncHostResolver::OnDnsRequestComplete,
|
| + base::Bind(&AsyncHostResolver::OnDnsTransactionComplete,
|
| base::Unretained(this)),
|
| request->request_net_log());
|
| - dns_requests_.push_back(dns_req);
|
| - return dns_req->Start();
|
| + int rv = dns_req->Start();
|
| + if (rv == ERR_IO_PENDING)
|
| + dns_requests_.push_back(dns_req.release());
|
| + return rv;
|
| }
|
|
|
| int AsyncHostResolver::Enqueue(Request* request) {
|
|
|