Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: net/socket/transport_client_socket_pool.h

Issue 1096203006: Collect all ConnectionAttempts from both sockets in TransportConnectJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@domrel_serverip1
Patch Set: Add a couple comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
216 // Used in the failure case to save connection attempts made on the main and
217 // fallback sockets and pass them on in |GetAdditionalErrorState|. (In the
218 // success case, connection attempts are passed through the returned socket;
219 // attempts are copied from the other socket, if one exists, into it before
220 // it is returned.)
221 ConnectionAttempts connection_attempts_;
222 ConnectionAttempts fallback_connection_attempts_;
213 223
214 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); 224 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob);
215 }; 225 };
216 226
217 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { 227 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool {
218 public: 228 public:
219 typedef TransportSocketParams SocketParams; 229 typedef TransportSocketParams SocketParams;
220 230
221 TransportClientSocketPool( 231 TransportClientSocketPool(
222 int max_sockets, 232 int max_sockets,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 break; 364 break;
355 } 365 }
356 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); 366 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
357 367
358 return rv; 368 return rv;
359 } 369 }
360 370
361 } // namespace net 371 } // namespace net
362 372
363 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ 373 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698