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

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: Changed one shared bool to a normal bool 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 RequestPriority priority, 187 RequestPriority priority,
188 const scoped_refptr<TransportSocketParams>& params, 188 const scoped_refptr<TransportSocketParams>& params,
189 base::TimeDelta timeout_duration, 189 base::TimeDelta timeout_duration,
190 ClientSocketFactory* client_socket_factory, 190 ClientSocketFactory* client_socket_factory,
191 HostResolver* host_resolver, 191 HostResolver* host_resolver,
192 Delegate* delegate, 192 Delegate* delegate,
193 NetLog* net_log) 193 NetLog* net_log)
194 : ConnectJob(group_name, timeout_duration, priority, delegate, 194 : ConnectJob(group_name, timeout_duration, priority, delegate,
195 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)), 195 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
196 helper_(params, client_socket_factory, host_resolver, &connect_timing_), 196 helper_(params, client_socket_factory, host_resolver, &connect_timing_),
197 interval_between_connects_(CONNECT_INTERVAL_GT_20MS) { 197 interval_between_connects_(CONNECT_INTERVAL_GT_20MS),
198 group_name_(group_name) {
198 helper_.SetOnIOComplete(this); 199 helper_.SetOnIOComplete(this);
199 } 200 }
200 201
201 TransportConnectJob::~TransportConnectJob() { 202 TransportConnectJob::~TransportConnectJob() {
202 // We don't worry about cancelling the host resolution and TCP connect, since 203 // We don't worry about cancelling the host resolution and TCP connect, since
203 // ~SingleRequestHostResolver and ~StreamSocket will take care of it. 204 // ~SingleRequestHostResolver and ~StreamSocket will take care of it.
204 } 205 }
205 206
206 LoadState TransportConnectJob::GetLoadState() const { 207 LoadState TransportConnectJob::GetLoadState() const {
207 switch (helper_.next_state()) { 208 switch (helper_.next_state()) {
(...skipping 46 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 // Enable TCP FastOpen if SSL socket. (This is a quite a hackish
267 // approach, but using TFO requires a more substantial change in the
268 // socket create/connect path.)
269 // TODO (jri): Finch trial this.
270 if (group_name_.substr(0, 3) == "ssl") {
mmenke 2014/08/12 15:25:16 This seems a really bad idea. Looking at my conne
mmenke 2014/08/12 15:36:44 And just to elaborate a little, I don't think the
Jana 2014/08/13 07:33:40 Acknowledged.
Jana 2014/08/13 07:33:40 Changed to use TransportSocketParams, PTAL. (I've
271 transport_socket_->EnableTCPFastOpen();
272 }
273
264 int rv = transport_socket_->Connect(helper_.on_io_complete()); 274 int rv = transport_socket_->Connect(helper_.on_io_complete());
265 if (rv == ERR_IO_PENDING && 275 if (rv == ERR_IO_PENDING &&
266 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV6 && 276 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV6 &&
267 !AddressListOnlyContainsIPv6(helper_.addresses())) { 277 !AddressListOnlyContainsIPv6(helper_.addresses())) {
268 fallback_timer_.Start( 278 fallback_timer_.Start(
269 FROM_HERE, 279 FROM_HERE,
270 base::TimeDelta::FromMilliseconds( 280 base::TimeDelta::FromMilliseconds(
271 TransportConnectJobHelper::kIPv6FallbackTimerInMs), 281 TransportConnectJobHelper::kIPv6FallbackTimerInMs),
272 this, 282 this,
273 &TransportConnectJob::DoIPv6FallbackTransportConnect); 283 &TransportConnectJob::DoIPv6FallbackTransportConnect);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 HigherLayeredPool* higher_pool) { 545 HigherLayeredPool* higher_pool) {
536 base_.AddHigherLayeredPool(higher_pool); 546 base_.AddHigherLayeredPool(higher_pool);
537 } 547 }
538 548
539 void TransportClientSocketPool::RemoveHigherLayeredPool( 549 void TransportClientSocketPool::RemoveHigherLayeredPool(
540 HigherLayeredPool* higher_pool) { 550 HigherLayeredPool* higher_pool) {
541 base_.RemoveHigherLayeredPool(higher_pool); 551 base_.RemoveHigherLayeredPool(higher_pool);
542 } 552 }
543 553
544 } // namespace net 554 } // namespace net
OLDNEW
« net/socket/tcp_socket_libevent.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