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