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_socket_pool.h" | 5 #include "net/dns/dns_socket_pool.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (socket.get()) { | 80 if (socket.get()) { |
81 int rv = socket->Connect((*nameservers_)[server_index]); | 81 int rv = socket->Connect((*nameservers_)[server_index]); |
82 if (rv != OK) { | 82 if (rv != OK) { |
83 VLOG(1) << "Failed to connect socket: " << rv; | 83 VLOG(1) << "Failed to connect socket: " << rv; |
84 socket.reset(); | 84 socket.reset(); |
85 } | 85 } |
86 } else { | 86 } else { |
87 LOG(WARNING) << "Failed to create socket."; | 87 LOG(WARNING) << "Failed to create socket."; |
88 } | 88 } |
89 | 89 |
90 return socket.Pass(); | 90 return socket; |
91 } | 91 } |
92 | 92 |
93 class NullDnsSocketPool : public DnsSocketPool { | 93 class NullDnsSocketPool : public DnsSocketPool { |
94 public: | 94 public: |
95 NullDnsSocketPool(ClientSocketFactory* factory) | 95 NullDnsSocketPool(ClientSocketFactory* factory) |
96 : DnsSocketPool(factory) { | 96 : DnsSocketPool(factory) { |
97 } | 97 } |
98 | 98 |
99 void Initialize(const std::vector<IPEndPoint>* nameservers, | 99 void Initialize(const std::vector<IPEndPoint>* nameservers, |
100 NetLog* net_log) override { | 100 NetLog* net_log) override { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 for (unsigned pool_index = pool.size(); pool_index < size; ++pool_index) { | 209 for (unsigned pool_index = pool.size(); pool_index < size; ++pool_index) { |
210 DatagramClientSocket* socket = | 210 DatagramClientSocket* socket = |
211 CreateConnectedSocket(server_index).release(); | 211 CreateConnectedSocket(server_index).release(); |
212 if (!socket) | 212 if (!socket) |
213 break; | 213 break; |
214 pool.push_back(socket); | 214 pool.push_back(socket); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 } // namespace net | 218 } // namespace net |
OLD | NEW |