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

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

Issue 14760008: HostResolverImpl will return ERR_NAME_NOT_RESOLVED instead of Ok if address list is empty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed Empty List check from OnProcTaskComplete. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/dns/host_resolver_impl_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "net/dns/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 StartLookupAttempt(); 675 StartLookupAttempt();
676 } 676 }
677 677
678 // Callback for when DoLookup() completes (runs on origin thread). 678 // Callback for when DoLookup() completes (runs on origin thread).
679 void OnLookupComplete(const AddressList& results, 679 void OnLookupComplete(const AddressList& results,
680 const base::TimeTicks& start_time, 680 const base::TimeTicks& start_time,
681 const uint32 attempt_number, 681 const uint32 attempt_number,
682 int error, 682 int error,
683 const int os_error) { 683 const int os_error) {
684 DCHECK(origin_loop_->BelongsToCurrentThread()); 684 DCHECK(origin_loop_->BelongsToCurrentThread());
685 DCHECK(error || !results.empty()); 685 // If results are empty, we should return an error.
686 bool empty_list_on_ok = (error == OK && results.empty());
687 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok);
688 if (empty_list_on_ok)
689 error = ERR_NAME_NOT_RESOLVED;
686 690
687 bool was_retry_attempt = attempt_number > 1; 691 bool was_retry_attempt = attempt_number > 1;
688 692
689 // Ideally the following code would be part of host_resolver_proc.cc, 693 // Ideally the following code would be part of host_resolver_proc.cc,
690 // however it isn't safe to call NetworkChangeNotifier from worker threads. 694 // however it isn't safe to call NetworkChangeNotifier from worker threads.
691 // So we do it here on the IO thread instead. 695 // So we do it here on the IO thread instead.
692 if (error != OK && NetworkChangeNotifier::IsOffline()) 696 if (error != OK && NetworkChangeNotifier::IsOffline())
693 error = ERR_INTERNET_DISCONNECTED; 697 error = ERR_INTERNET_DISCONNECTED;
694 698
695 // If this is the first attempt that is finishing later, then record data 699 // If this is the first attempt that is finishing later, then record data
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 } 2233 }
2230 DnsConfig dns_config; 2234 DnsConfig dns_config;
2231 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2235 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2232 dns_client_->SetConfig(dns_config); 2236 dns_client_->SetConfig(dns_config);
2233 num_dns_failures_ = 0; 2237 num_dns_failures_ = 0;
2234 if (dns_config.IsValid()) 2238 if (dns_config.IsValid())
2235 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2239 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2236 } 2240 }
2237 2241
2238 } // namespace net 2242 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/dns/host_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698