OLD | NEW |
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/dns_session.h" | 5 #include "net/dns/dns_session.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/metrics/sample_vector.h" | 11 #include "base/metrics/sample_vector.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/time.h" | 14 #include "base/time/time.h" |
15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/dns/dns_config_service.h" | 17 #include "net/dns/dns_config_service.h" |
18 #include "net/dns/dns_socket_pool.h" | 18 #include "net/dns/dns_socket_pool.h" |
19 #include "net/socket/stream_socket.h" | 19 #include "net/socket/stream_socket.h" |
20 #include "net/udp/datagram_client_socket.h" | 20 #include "net/udp/datagram_client_socket.h" |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 namespace { | 24 namespace { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs)); | 295 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs)); |
296 | 296 |
297 // The timeout still doubles every full round. | 297 // The timeout still doubles every full round. |
298 unsigned num_backoffs = attempt / config_.nameservers.size(); | 298 unsigned num_backoffs = attempt / config_.nameservers.size(); |
299 | 299 |
300 return std::min(timeout * (1 << num_backoffs), | 300 return std::min(timeout * (1 << num_backoffs), |
301 base::TimeDelta::FromMilliseconds(kMaxTimeoutMs)); | 301 base::TimeDelta::FromMilliseconds(kMaxTimeoutMs)); |
302 } | 302 } |
303 | 303 |
304 } // namespace net | 304 } // namespace net |
OLD | NEW |