| 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 #include "net/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_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/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return ssl_params_->GetDirectConnectionParams()->destination(); | 63 return ssl_params_->GetDirectConnectionParams()->destination(); |
| 64 } else { | 64 } else { |
| 65 return transport_params_->destination(); | 65 return transport_params_->destination(); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 HttpProxySocketParams::~HttpProxySocketParams() {} | 69 HttpProxySocketParams::~HttpProxySocketParams() {} |
| 70 | 70 |
| 71 // HttpProxyConnectJobs will time out after this many seconds. Note this is on | 71 // HttpProxyConnectJobs will time out after this many seconds. Note this is on |
| 72 // top of the timeout for the transport socket. | 72 // top of the timeout for the transport socket. |
| 73 #if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN) | 73 // TODO(kundaji): Proxy connect timeout should be independent of platform and be |
| 74 // based on proxy. Bug http://crbug.com/407446. |
| 75 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 74 static const int kHttpProxyConnectJobTimeoutInSeconds = 10; | 76 static const int kHttpProxyConnectJobTimeoutInSeconds = 10; |
| 75 #else | 77 #else |
| 76 static const int kHttpProxyConnectJobTimeoutInSeconds = 30; | 78 static const int kHttpProxyConnectJobTimeoutInSeconds = 30; |
| 77 #endif | 79 #endif |
| 78 | 80 |
| 79 | |
| 80 HttpProxyConnectJob::HttpProxyConnectJob( | 81 HttpProxyConnectJob::HttpProxyConnectJob( |
| 81 const std::string& group_name, | 82 const std::string& group_name, |
| 82 RequestPriority priority, | 83 RequestPriority priority, |
| 83 const scoped_refptr<HttpProxySocketParams>& params, | 84 const scoped_refptr<HttpProxySocketParams>& params, |
| 84 const base::TimeDelta& timeout_duration, | 85 const base::TimeDelta& timeout_duration, |
| 85 TransportClientSocketPool* transport_pool, | 86 TransportClientSocketPool* transport_pool, |
| 86 SSLClientSocketPool* ssl_pool, | 87 SSLClientSocketPool* ssl_pool, |
| 87 HostResolver* host_resolver, | 88 HostResolver* host_resolver, |
| 88 Delegate* delegate, | 89 Delegate* delegate, |
| 89 NetLog* net_log) | 90 NetLog* net_log) |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 HostResolver* host_resolver, | 378 HostResolver* host_resolver, |
| 378 const ProxyDelegate* proxy_delegate, | 379 const ProxyDelegate* proxy_delegate, |
| 379 NetLog* net_log) | 380 NetLog* net_log) |
| 380 : transport_pool_(transport_pool), | 381 : transport_pool_(transport_pool), |
| 381 ssl_pool_(ssl_pool), | 382 ssl_pool_(ssl_pool), |
| 382 host_resolver_(host_resolver), | 383 host_resolver_(host_resolver), |
| 383 proxy_delegate_(proxy_delegate), | 384 proxy_delegate_(proxy_delegate), |
| 384 net_log_(net_log) { | 385 net_log_(net_log) { |
| 385 base::TimeDelta max_pool_timeout = base::TimeDelta(); | 386 base::TimeDelta max_pool_timeout = base::TimeDelta(); |
| 386 | 387 |
| 387 #if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN) | 388 // TODO(kundaji): Proxy connect timeout should be independent of platform and be |
| 389 // based on proxy. Bug http://crbug.com/407446. |
| 390 #if (defined(OS_ANDROID) || defined(OS_IOS)) |
| 388 #else | 391 #else |
| 389 if (transport_pool_) | 392 if (transport_pool_) |
| 390 max_pool_timeout = transport_pool_->ConnectionTimeout(); | 393 max_pool_timeout = transport_pool_->ConnectionTimeout(); |
| 391 if (ssl_pool_) | 394 if (ssl_pool_) |
| 392 max_pool_timeout = std::max(max_pool_timeout, | 395 max_pool_timeout = std::max(max_pool_timeout, |
| 393 ssl_pool_->ConnectionTimeout()); | 396 ssl_pool_->ConnectionTimeout()); |
| 394 #endif | 397 #endif |
| 395 timeout_ = max_pool_timeout + | 398 timeout_ = max_pool_timeout + |
| 396 base::TimeDelta::FromSeconds(kHttpProxyConnectJobTimeoutInSeconds); | 399 base::TimeDelta::FromSeconds(kHttpProxyConnectJobTimeoutInSeconds); |
| 397 } | 400 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 base_.RemoveHigherLayeredPool(higher_pool); | 551 base_.RemoveHigherLayeredPool(higher_pool); |
| 549 } | 552 } |
| 550 | 553 |
| 551 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { | 554 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { |
| 552 if (base_.CloseOneIdleSocket()) | 555 if (base_.CloseOneIdleSocket()) |
| 553 return true; | 556 return true; |
| 554 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 557 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 555 } | 558 } |
| 556 | 559 |
| 557 } // namespace net | 560 } // namespace net |
| OLD | NEW |