Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/ssl_cert_request_info.h" | 10 #include "net/base/ssl_cert_request_info.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 68 |
| 69 SSLConnectJob::SSLConnectJob( | 69 SSLConnectJob::SSLConnectJob( |
| 70 const std::string& group_name, | 70 const std::string& group_name, |
| 71 const scoped_refptr<SSLSocketParams>& params, | 71 const scoped_refptr<SSLSocketParams>& params, |
| 72 const base::TimeDelta& timeout_duration, | 72 const base::TimeDelta& timeout_duration, |
| 73 TCPClientSocketPool* tcp_pool, | 73 TCPClientSocketPool* tcp_pool, |
| 74 SOCKSClientSocketPool* socks_pool, | 74 SOCKSClientSocketPool* socks_pool, |
| 75 HttpProxyClientSocketPool* http_proxy_pool, | 75 HttpProxyClientSocketPool* http_proxy_pool, |
| 76 ClientSocketFactory* client_socket_factory, | 76 ClientSocketFactory* client_socket_factory, |
| 77 HostResolver* host_resolver, | 77 HostResolver* host_resolver, |
| 78 DnsRRResolver* dnsrr_resolver, | |
| 78 Delegate* delegate, | 79 Delegate* delegate, |
| 79 NetLog* net_log) | 80 NetLog* net_log) |
| 80 : ConnectJob(group_name, timeout_duration, delegate, | 81 : ConnectJob(group_name, timeout_duration, delegate, |
| 81 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)), | 82 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)), |
| 82 params_(params), | 83 params_(params), |
| 83 tcp_pool_(tcp_pool), | 84 tcp_pool_(tcp_pool), |
| 84 socks_pool_(socks_pool), | 85 socks_pool_(socks_pool), |
| 85 http_proxy_pool_(http_proxy_pool), | 86 http_proxy_pool_(http_proxy_pool), |
| 86 client_socket_factory_(client_socket_factory), | 87 client_socket_factory_(client_socket_factory), |
| 87 resolver_(host_resolver), | 88 resolver_(host_resolver), |
| 89 dnsrr_resolver_(dnsrr_resolver), | |
| 88 ALLOW_THIS_IN_INITIALIZER_LIST( | 90 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 89 callback_(this, &SSLConnectJob::OnIOComplete)) {} | 91 callback_(this, &SSLConnectJob::OnIOComplete)) {} |
| 90 | 92 |
| 91 SSLConnectJob::~SSLConnectJob() {} | 93 SSLConnectJob::~SSLConnectJob() {} |
| 92 | 94 |
| 93 LoadState SSLConnectJob::GetLoadState() const { | 95 LoadState SSLConnectJob::GetLoadState() const { |
| 94 switch (next_state_) { | 96 switch (next_state_) { |
| 95 case STATE_TUNNEL_CONNECT_COMPLETE: | 97 case STATE_TUNNEL_CONNECT_COMPLETE: |
| 96 if (transport_socket_handle_->socket()) | 98 if (transport_socket_handle_->socket()) |
| 97 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; | 99 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 | 333 |
| 332 return result; | 334 return result; |
| 333 } | 335 } |
| 334 | 336 |
| 335 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( | 337 ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( |
| 336 const std::string& group_name, | 338 const std::string& group_name, |
| 337 const PoolBase::Request& request, | 339 const PoolBase::Request& request, |
| 338 ConnectJob::Delegate* delegate) const { | 340 ConnectJob::Delegate* delegate) const { |
| 339 return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(), | 341 return new SSLConnectJob(group_name, request.params(), ConnectionTimeout(), |
| 340 tcp_pool_, socks_pool_, http_proxy_pool_, | 342 tcp_pool_, socks_pool_, http_proxy_pool_, |
| 341 client_socket_factory_, host_resolver_, delegate, | 343 client_socket_factory_, host_resolver_, dnsrr_resolve r_, |
|
willchan no longer on Chromium
2010/10/05 04:33:08
80 columns
| |
| 342 net_log_); | 344 delegate, net_log_); |
| 343 } | 345 } |
| 344 | 346 |
| 345 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory( | 347 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory( |
| 346 TCPClientSocketPool* tcp_pool, | 348 TCPClientSocketPool* tcp_pool, |
| 347 SOCKSClientSocketPool* socks_pool, | 349 SOCKSClientSocketPool* socks_pool, |
| 348 HttpProxyClientSocketPool* http_proxy_pool, | 350 HttpProxyClientSocketPool* http_proxy_pool, |
| 349 ClientSocketFactory* client_socket_factory, | 351 ClientSocketFactory* client_socket_factory, |
| 350 HostResolver* host_resolver, | 352 HostResolver* host_resolver, |
| 353 DnsRRResolver* dnsrr_resolver, | |
| 351 NetLog* net_log) | 354 NetLog* net_log) |
| 352 : tcp_pool_(tcp_pool), | 355 : tcp_pool_(tcp_pool), |
| 353 socks_pool_(socks_pool), | 356 socks_pool_(socks_pool), |
| 354 http_proxy_pool_(http_proxy_pool), | 357 http_proxy_pool_(http_proxy_pool), |
| 355 client_socket_factory_(client_socket_factory), | 358 client_socket_factory_(client_socket_factory), |
| 356 host_resolver_(host_resolver), | 359 host_resolver_(host_resolver), |
| 360 dnsrr_resolver_(dnsrr_resolver), | |
| 357 net_log_(net_log) { | 361 net_log_(net_log) { |
| 358 base::TimeDelta max_transport_timeout = base::TimeDelta(); | 362 base::TimeDelta max_transport_timeout = base::TimeDelta(); |
| 359 base::TimeDelta pool_timeout; | 363 base::TimeDelta pool_timeout; |
| 360 if (tcp_pool_) | 364 if (tcp_pool_) |
| 361 max_transport_timeout = tcp_pool_->ConnectionTimeout(); | 365 max_transport_timeout = tcp_pool_->ConnectionTimeout(); |
| 362 if (socks_pool_) { | 366 if (socks_pool_) { |
| 363 pool_timeout = socks_pool_->ConnectionTimeout(); | 367 pool_timeout = socks_pool_->ConnectionTimeout(); |
| 364 if (pool_timeout > max_transport_timeout) | 368 if (pool_timeout > max_transport_timeout) |
| 365 max_transport_timeout = pool_timeout; | 369 max_transport_timeout = pool_timeout; |
| 366 } | 370 } |
| 367 if (http_proxy_pool_) { | 371 if (http_proxy_pool_) { |
| 368 pool_timeout = http_proxy_pool_->ConnectionTimeout(); | 372 pool_timeout = http_proxy_pool_->ConnectionTimeout(); |
| 369 if (pool_timeout > max_transport_timeout) | 373 if (pool_timeout > max_transport_timeout) |
| 370 max_transport_timeout = pool_timeout; | 374 max_transport_timeout = pool_timeout; |
| 371 } | 375 } |
| 372 timeout_ = max_transport_timeout + | 376 timeout_ = max_transport_timeout + |
| 373 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); | 377 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); |
| 374 } | 378 } |
| 375 | 379 |
| 376 SSLClientSocketPool::SSLClientSocketPool( | 380 SSLClientSocketPool::SSLClientSocketPool( |
| 377 int max_sockets, | 381 int max_sockets, |
| 378 int max_sockets_per_group, | 382 int max_sockets_per_group, |
| 379 ClientSocketPoolHistograms* histograms, | 383 ClientSocketPoolHistograms* histograms, |
| 380 HostResolver* host_resolver, | 384 HostResolver* host_resolver, |
| 385 DnsRRResolver* dnsrr_resolver, | |
| 381 ClientSocketFactory* client_socket_factory, | 386 ClientSocketFactory* client_socket_factory, |
| 382 TCPClientSocketPool* tcp_pool, | 387 TCPClientSocketPool* tcp_pool, |
| 383 SOCKSClientSocketPool* socks_pool, | 388 SOCKSClientSocketPool* socks_pool, |
| 384 HttpProxyClientSocketPool* http_proxy_pool, | 389 HttpProxyClientSocketPool* http_proxy_pool, |
| 385 SSLConfigService* ssl_config_service, | 390 SSLConfigService* ssl_config_service, |
| 386 NetLog* net_log) | 391 NetLog* net_log) |
| 387 : tcp_pool_(tcp_pool), | 392 : tcp_pool_(tcp_pool), |
| 388 socks_pool_(socks_pool), | 393 socks_pool_(socks_pool), |
| 389 http_proxy_pool_(http_proxy_pool), | 394 http_proxy_pool_(http_proxy_pool), |
| 390 base_(max_sockets, max_sockets_per_group, histograms, | 395 base_(max_sockets, max_sockets_per_group, histograms, |
| 391 base::TimeDelta::FromSeconds( | 396 base::TimeDelta::FromSeconds( |
| 392 ClientSocketPool::unused_idle_socket_timeout()), | 397 ClientSocketPool::unused_idle_socket_timeout()), |
| 393 base::TimeDelta::FromSeconds(kUsedIdleSocketTimeout), | 398 base::TimeDelta::FromSeconds(kUsedIdleSocketTimeout), |
| 394 new SSLConnectJobFactory(tcp_pool, socks_pool, http_proxy_pool, | 399 new SSLConnectJobFactory(tcp_pool, socks_pool, http_proxy_pool, |
| 395 client_socket_factory, host_resolver, | 400 client_socket_factory, host_resolver, |
| 396 net_log)), | 401 dnsrr_resolver, net_log)), |
| 397 ssl_config_service_(ssl_config_service) { | 402 ssl_config_service_(ssl_config_service) { |
| 398 if (ssl_config_service_) | 403 if (ssl_config_service_) |
| 399 ssl_config_service_->AddObserver(this); | 404 ssl_config_service_->AddObserver(this); |
| 400 } | 405 } |
| 401 | 406 |
| 402 SSLClientSocketPool::~SSLClientSocketPool() { | 407 SSLClientSocketPool::~SSLClientSocketPool() { |
| 403 if (ssl_config_service_) | 408 if (ssl_config_service_) |
| 404 ssl_config_service_->RemoveObserver(this); | 409 ssl_config_service_->RemoveObserver(this); |
| 405 } | 410 } |
| 406 | 411 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool", | 475 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool", |
| 471 "http_proxy_pool", | 476 "http_proxy_pool", |
| 472 true)); | 477 true)); |
| 473 } | 478 } |
| 474 dict->Set("nested_pools", list); | 479 dict->Set("nested_pools", list); |
| 475 } | 480 } |
| 476 return dict; | 481 return dict; |
| 477 } | 482 } |
| 478 | 483 |
| 479 } // namespace net | 484 } // namespace net |
| OLD | NEW |