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

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

Issue 451383002: Plumbing for TCP FastOpen for SSL sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed shared bools and now using TransportSocketParams. Created 6 years, 4 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 #include "net/socket/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static base::LazyInstance<base::TimeTicks>::Leaky 56 static base::LazyInstance<base::TimeTicks>::Leaky
57 g_last_connect_time = LAZY_INSTANCE_INITIALIZER; 57 g_last_connect_time = LAZY_INSTANCE_INITIALIZER;
58 58
59 TransportSocketParams::TransportSocketParams( 59 TransportSocketParams::TransportSocketParams(
60 const HostPortPair& host_port_pair, 60 const HostPortPair& host_port_pair,
61 bool disable_resolver_cache, 61 bool disable_resolver_cache,
62 bool ignore_limits, 62 bool ignore_limits,
63 const OnHostResolutionCallback& host_resolution_callback) 63 const OnHostResolutionCallback& host_resolution_callback)
64 : destination_(host_port_pair), 64 : destination_(host_port_pair),
65 ignore_limits_(ignore_limits), 65 ignore_limits_(ignore_limits),
66 host_resolution_callback_(host_resolution_callback) { 66 host_resolution_callback_(host_resolution_callback),
67 use_tcp_fastopen_(false) {
67 if (disable_resolver_cache) 68 if (disable_resolver_cache)
68 destination_.set_allow_cached_response(false); 69 destination_.set_allow_cached_response(false);
69 } 70 }
70 71
71 TransportSocketParams::~TransportSocketParams() {} 72 TransportSocketParams::~TransportSocketParams() {}
72 73
73 // TransportConnectJobs will time out after this many seconds. Note this is 74 // TransportConnectJobs will time out after this many seconds. Note this is
74 // the total time, including both host resolution and TCP connect() times. 75 // the total time, including both host resolution and TCP connect() times.
75 // 76 //
76 // TODO(eroman): The use of this constant needs to be re-evaluated. The time 77 // TODO(eroman): The use of this constant needs to be re-evaluated. The time
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS; 255 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS;
255 else 256 else
256 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; 257 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS;
257 } 258 }
258 259
259 helper_.set_next_state( 260 helper_.set_next_state(
260 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE); 261 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE);
261 transport_socket_ = 262 transport_socket_ =
262 helper_.client_socket_factory()->CreateTransportClientSocket( 263 helper_.client_socket_factory()->CreateTransportClientSocket(
263 helper_.addresses(), net_log().net_log(), net_log().source()); 264 helper_.addresses(), net_log().net_log(), net_log().source());
265
266 if (helper_.params()->use_tcp_fastopen())
267 transport_socket_->EnableTCPFastOpen();
268
264 int rv = transport_socket_->Connect(helper_.on_io_complete()); 269 int rv = transport_socket_->Connect(helper_.on_io_complete());
265 if (rv == ERR_IO_PENDING && 270 if (rv == ERR_IO_PENDING &&
266 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV6 && 271 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV6 &&
267 !AddressListOnlyContainsIPv6(helper_.addresses())) { 272 !AddressListOnlyContainsIPv6(helper_.addresses())) {
268 fallback_timer_.Start( 273 fallback_timer_.Start(
269 FROM_HERE, 274 FROM_HERE,
270 base::TimeDelta::FromMilliseconds( 275 base::TimeDelta::FromMilliseconds(
271 TransportConnectJobHelper::kIPv6FallbackTimerInMs), 276 TransportConnectJobHelper::kIPv6FallbackTimerInMs),
272 this, 277 this,
273 &TransportConnectJob::DoIPv6FallbackTransportConnect); 278 &TransportConnectJob::DoIPv6FallbackTransportConnect);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 HigherLayeredPool* higher_pool) { 540 HigherLayeredPool* higher_pool) {
536 base_.AddHigherLayeredPool(higher_pool); 541 base_.AddHigherLayeredPool(higher_pool);
537 } 542 }
538 543
539 void TransportClientSocketPool::RemoveHigherLayeredPool( 544 void TransportClientSocketPool::RemoveHigherLayeredPool(
540 HigherLayeredPool* higher_pool) { 545 HigherLayeredPool* higher_pool) {
541 base_.RemoveHigherLayeredPool(higher_pool); 546 base_.RemoveHigherLayeredPool(higher_pool);
542 } 547 }
543 548
544 } // namespace net 549 } // namespace net
OLDNEW
« net/socket/ssl_client_socket_pool.cc ('K') | « net/socket/transport_client_socket_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698