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 #include <utility> | 10 #include <utility> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "net/base/ip_endpoint.h" | 23 #include "net/base/ip_endpoint.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
25 #include "net/dns/dns_config_service.h" | 25 #include "net/dns/dns_config_service.h" |
26 #include "net/dns/dns_socket_pool.h" | 26 #include "net/dns/dns_socket_pool.h" |
27 #include "net/dns/dns_util.h" | 27 #include "net/dns/dns_util.h" |
28 #include "net/log/net_log_event_type.h" | 28 #include "net/log/net_log_event_type.h" |
29 #include "net/log/net_log_source.h" | 29 #include "net/log/net_log_source.h" |
30 #include "net/log/net_log_with_source.h" | 30 #include "net/log/net_log_with_source.h" |
| 31 #include "net/socket/datagram_client_socket.h" |
31 #include "net/socket/stream_socket.h" | 32 #include "net/socket/stream_socket.h" |
32 #include "net/udp/datagram_client_socket.h" | |
33 | 33 |
34 namespace net { | 34 namespace net { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 // Set min timeout, in case we are talking to a local DNS proxy. | 38 // Set min timeout, in case we are talking to a local DNS proxy. |
39 const unsigned kMinTimeoutMs = 10; | 39 const unsigned kMinTimeoutMs = 10; |
40 | 40 |
41 // Default maximum timeout between queries, even with exponential backoff. | 41 // Default maximum timeout between queries, even with exponential backoff. |
42 // (Can be overridden by field trial.) | 42 // (Can be overridden by field trial.) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs)); | 349 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs)); |
350 | 350 |
351 // The timeout still doubles every full round. | 351 // The timeout still doubles every full round. |
352 unsigned num_backoffs = attempt / config_.nameservers.size(); | 352 unsigned num_backoffs = attempt / config_.nameservers.size(); |
353 | 353 |
354 return std::min(timeout * (1 << num_backoffs), max_timeout_); | 354 return std::min(timeout * (1 << num_backoffs), max_timeout_); |
355 } | 355 } |
356 | 356 |
357 } // namespace net | 357 } // namespace net |
OLD | NEW |