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 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/dns/host_resolver.h" | 16 #include "net/dns/host_resolver.h" |
17 #include "net/dns/single_request_host_resolver.h" | 17 #include "net/dns/single_request_host_resolver.h" |
18 #include "net/socket/client_socket_pool.h" | 18 #include "net/socket/client_socket_pool.h" |
19 #include "net/socket/client_socket_pool_base.h" | 19 #include "net/socket/client_socket_pool_base.h" |
20 #include "net/socket/connection_attempts.h" | |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 class ClientSocketFactory; | 24 class ClientSocketFactory; |
24 | 25 |
25 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> | 26 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> |
26 OnHostResolutionCallback; | 27 OnHostResolutionCallback; |
27 | 28 |
28 class NET_EXPORT_PRIVATE TransportSocketParams | 29 class NET_EXPORT_PRIVATE TransportSocketParams |
29 : public base::RefCounted<TransportSocketParams> { | 30 : public base::RefCounted<TransportSocketParams> { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 | 190 |
190 // Not part of the state machine. | 191 // Not part of the state machine. |
191 void DoIPv6FallbackTransportConnect(); | 192 void DoIPv6FallbackTransportConnect(); |
192 void DoIPv6FallbackTransportConnectComplete(int result); | 193 void DoIPv6FallbackTransportConnectComplete(int result); |
193 | 194 |
194 // Begins the host resolution and the TCP connect. Returns OK on success | 195 // Begins the host resolution and the TCP connect. Returns OK on success |
195 // and ERR_IO_PENDING if it cannot immediately service the request. | 196 // and ERR_IO_PENDING if it cannot immediately service the request. |
196 // Otherwise, it returns a net error code. | 197 // Otherwise, it returns a net error code. |
197 int ConnectInternal() override; | 198 int ConnectInternal() override; |
198 | 199 |
200 void CopyConnectionAttemptsFromClientSocketHandles(); | |
201 | |
199 TransportConnectJobHelper helper_; | 202 TransportConnectJobHelper helper_; |
200 | 203 |
201 scoped_ptr<StreamSocket> transport_socket_; | 204 scoped_ptr<StreamSocket> transport_socket_; |
202 | 205 |
203 scoped_ptr<StreamSocket> fallback_transport_socket_; | 206 scoped_ptr<StreamSocket> fallback_transport_socket_; |
204 scoped_ptr<AddressList> fallback_addresses_; | 207 scoped_ptr<AddressList> fallback_addresses_; |
205 base::TimeTicks fallback_connect_start_time_; | 208 base::TimeTicks fallback_connect_start_time_; |
206 base::OneShotTimer<TransportConnectJob> fallback_timer_; | 209 base::OneShotTimer<TransportConnectJob> fallback_timer_; |
207 | 210 |
208 // Track the interval between this connect and previous connect. | 211 // Track the interval between this connect and previous connect. |
209 ConnectInterval interval_between_connects_; | 212 ConnectInterval interval_between_connects_; |
210 | 213 |
211 int resolve_result_; | 214 int resolve_result_; |
212 int connect_result_; | 215 int connect_result_; |
213 | 216 |
217 // Saved when connections fail and passed up in GetAdditionalErrorState. | |
Randy Smith (Not in Mondays)
2015/05/12 20:11:09
Ok, so I want to seriously bulk up this comment, a
Deprecated (see juliatuttle)
2015/05/13 18:22:29
Done.
| |
218 ConnectionAttempts connection_attempts_; | |
219 ConnectionAttempts fallback_connection_attempts_; | |
220 | |
214 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); | 221 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); |
215 }; | 222 }; |
216 | 223 |
217 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { | 224 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { |
218 public: | 225 public: |
219 typedef TransportSocketParams SocketParams; | 226 typedef TransportSocketParams SocketParams; |
220 | 227 |
221 TransportClientSocketPool( | 228 TransportClientSocketPool( |
222 int max_sockets, | 229 int max_sockets, |
223 int max_sockets_per_group, | 230 int max_sockets_per_group, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 break; | 361 break; |
355 } | 362 } |
356 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 363 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
357 | 364 |
358 return rv; | 365 return rv; |
359 } | 366 } |
360 | 367 |
361 } // namespace net | 368 } // namespace net |
362 | 369 |
363 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 370 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |