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_config_service_posix.h" | 5 #include "net/dns/dns_config_service_posix.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } else { | 51 } else { |
52 result = CONFIG_PARSE_POSIX_RES_INIT_FAILED; | 52 result = CONFIG_PARSE_POSIX_RES_INIT_FAILED; |
53 } | 53 } |
54 // Prefer res_ndestroy where available. | 54 // Prefer res_ndestroy where available. |
55 #if defined(OS_MACOSX) || defined(OS_FREEBSD) | 55 #if defined(OS_MACOSX) || defined(OS_FREEBSD) |
56 res_ndestroy(&res); | 56 res_ndestroy(&res); |
57 #else | 57 #else |
58 res_nclose(&res); | 58 res_nclose(&res); |
59 #endif | 59 #endif |
60 #endif | 60 #endif |
| 61 // Override timeout value to match default setting on Windows. |
| 62 config->timeout = base::TimeDelta::FromSeconds(kDnsTimeoutSeconds); |
61 return result; | 63 return result; |
62 } | 64 } |
63 | 65 |
64 // A SerialWorker that uses libresolv to initialize res_state and converts | 66 // A SerialWorker that uses libresolv to initialize res_state and converts |
65 // it to DnsConfig. | 67 // it to DnsConfig. |
66 class ConfigReader : public SerialWorker { | 68 class ConfigReader : public SerialWorker { |
67 public: | 69 public: |
68 typedef base::Callback<void(const DnsConfig& config)> CallbackType; | 70 typedef base::Callback<void(const DnsConfig& config)> CallbackType; |
69 explicit ConfigReader(const CallbackType& callback) | 71 explicit ConfigReader(const CallbackType& callback) |
70 : callback_(callback), success_(false) {} | 72 : callback_(callback), success_(false) {} |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 virtual ~StubDnsConfigService() {} | 285 virtual ~StubDnsConfigService() {} |
284 virtual void OnDNSChanged(unsigned detail) OVERRIDE {} | 286 virtual void OnDNSChanged(unsigned detail) OVERRIDE {} |
285 }; | 287 }; |
286 // static | 288 // static |
287 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 289 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
288 return scoped_ptr<DnsConfigService>(new StubDnsConfigService()); | 290 return scoped_ptr<DnsConfigService>(new StubDnsConfigService()); |
289 } | 291 } |
290 #endif | 292 #endif |
291 | 293 |
292 } // namespace net | 294 } // namespace net |
OLD | NEW |