[email protected] | e34400c3 | 2012-01-24 02:49:33 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/socket/socks_client_socket_pool.h" |
| 6 | |
[email protected] | 6ecf2b9 | 2011-12-15 01:14:52 | [diff] [blame] | 7 | #include "base/bind.h" |
| 8 | #include "base/bind_helpers.h" |
[email protected] | f002abb | 2013-06-28 02:30:21 | [diff] [blame] | 9 | #include "base/time/time.h" |
[email protected] | ba00b49 | 2010-09-08 14:53:38 | [diff] [blame] | 10 | #include "base/values.h" |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 11 | #include "net/base/net_errors.h" |
| 12 | #include "net/socket/client_socket_factory.h" |
| 13 | #include "net/socket/client_socket_handle.h" |
| 14 | #include "net/socket/client_socket_pool_base.h" |
| 15 | #include "net/socket/socks5_client_socket.h" |
| 16 | #include "net/socket/socks_client_socket.h" |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 17 | #include "net/socket/transport_client_socket_pool.h" |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 18 | |
| 19 | namespace net { |
| 20 | |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 21 | SOCKSSocketParams::SOCKSSocketParams( |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 22 | const scoped_refptr<TransportSocketParams>& proxy_server, |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 23 | bool socks_v5, |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 24 | const HostPortPair& host_port_pair) |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 25 | : transport_params_(proxy_server), |
[email protected] | 5109c195 | 2013-08-20 18:44:10 | [diff] [blame] | 26 | destination_(host_port_pair), |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 27 | socks_v5_(socks_v5) { |
[email protected] | 9049948 | 2013-06-01 00:39:50 | [diff] [blame] | 28 | if (transport_params_.get()) |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 29 | ignore_limits_ = transport_params_->ignore_limits(); |
[email protected] | 5acdce1 | 2011-03-30 13:00:20 | [diff] [blame] | 30 | else |
| 31 | ignore_limits_ = false; |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | SOCKSSocketParams::~SOCKSSocketParams() {} |
| 35 | |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 36 | // SOCKSConnectJobs will time out after this many seconds. Note this is on |
| 37 | // top of the timeout for the transport socket. |
| 38 | static const int kSOCKSConnectJobTimeoutInSeconds = 30; |
| 39 | |
| 40 | SOCKSConnectJob::SOCKSConnectJob( |
| 41 | const std::string& group_name, |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 42 | RequestPriority priority, |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 43 | const scoped_refptr<SOCKSSocketParams>& socks_params, |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 44 | const base::TimeDelta& timeout_duration, |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 45 | TransportClientSocketPool* transport_pool, |
[email protected] | 73c4532 | 2010-10-01 23:57:54 | [diff] [blame] | 46 | HostResolver* host_resolver, |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 47 | Delegate* delegate, |
[email protected] | 06650c5 | 2010-06-03 00:49:17 | [diff] [blame] | 48 | NetLog* net_log) |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 49 | : ConnectJob(group_name, timeout_duration, priority, delegate, |
[email protected] | 06650c5 | 2010-06-03 00:49:17 | [diff] [blame] | 50 | BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)), |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 51 | socks_params_(socks_params), |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 52 | transport_pool_(transport_pool), |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 53 | resolver_(host_resolver), |
[email protected] | aa249b5 | 2013-04-30 01:04:32 | [diff] [blame] | 54 | callback_(base::Bind(&SOCKSConnectJob::OnIOComplete, |
| 55 | base::Unretained(this))) { |
[email protected] | 06650c5 | 2010-06-03 00:49:17 | [diff] [blame] | 56 | } |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 57 | |
| 58 | SOCKSConnectJob::~SOCKSConnectJob() { |
| 59 | // We don't worry about cancelling the tcp socket since the destructor in |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 60 | // scoped_ptr<ClientSocketHandle> transport_socket_handle_ will take care of |
| 61 | // it. |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | LoadState SOCKSConnectJob::GetLoadState() const { |
| 65 | switch (next_state_) { |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 66 | case STATE_TRANSPORT_CONNECT: |
| 67 | case STATE_TRANSPORT_CONNECT_COMPLETE: |
| 68 | return transport_socket_handle_->GetLoadState(); |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 69 | case STATE_SOCKS_CONNECT: |
| 70 | case STATE_SOCKS_CONNECT_COMPLETE: |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 71 | return LOAD_STATE_CONNECTING; |
| 72 | default: |
| 73 | NOTREACHED(); |
| 74 | return LOAD_STATE_IDLE; |
| 75 | } |
| 76 | } |
| 77 | |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 78 | void SOCKSConnectJob::OnIOComplete(int result) { |
| 79 | int rv = DoLoop(result); |
| 80 | if (rv != ERR_IO_PENDING) |
| 81 | NotifyDelegateOfCompletion(rv); // Deletes |this| |
| 82 | } |
| 83 | |
| 84 | int SOCKSConnectJob::DoLoop(int result) { |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 85 | DCHECK_NE(next_state_, STATE_NONE); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 86 | |
| 87 | int rv = result; |
| 88 | do { |
| 89 | State state = next_state_; |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 90 | next_state_ = STATE_NONE; |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 91 | switch (state) { |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 92 | case STATE_TRANSPORT_CONNECT: |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 93 | DCHECK_EQ(OK, rv); |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 94 | rv = DoTransportConnect(); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 95 | break; |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 96 | case STATE_TRANSPORT_CONNECT_COMPLETE: |
| 97 | rv = DoTransportConnectComplete(rv); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 98 | break; |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 99 | case STATE_SOCKS_CONNECT: |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 100 | DCHECK_EQ(OK, rv); |
| 101 | rv = DoSOCKSConnect(); |
| 102 | break; |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 103 | case STATE_SOCKS_CONNECT_COMPLETE: |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 104 | rv = DoSOCKSConnectComplete(rv); |
| 105 | break; |
| 106 | default: |
| 107 | NOTREACHED() << "bad state"; |
| 108 | rv = ERR_FAILED; |
| 109 | break; |
| 110 | } |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 111 | } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 112 | |
| 113 | return rv; |
| 114 | } |
| 115 | |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 116 | int SOCKSConnectJob::DoTransportConnect() { |
| 117 | next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE; |
| 118 | transport_socket_handle_.reset(new ClientSocketHandle()); |
[email protected] | 5109c195 | 2013-08-20 18:44:10 | [diff] [blame] | 119 | return transport_socket_handle_->Init(group_name(), |
| 120 | socks_params_->transport_params(), |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 121 | priority(), |
[email protected] | 5109c195 | 2013-08-20 18:44:10 | [diff] [blame] | 122 | callback_, |
| 123 | transport_pool_, |
| 124 | net_log()); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 125 | } |
| 126 | |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 127 | int SOCKSConnectJob::DoTransportConnectComplete(int result) { |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 128 | if (result != OK) |
[email protected] | f7fccee | 2010-09-16 20:53:01 | [diff] [blame] | 129 | return ERR_PROXY_CONNECTION_FAILED; |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 130 | |
| 131 | // Reset the timer to just the length of time allowed for SOCKS handshake |
| 132 | // so that a fast TCP connection plus a slow SOCKS failure doesn't take |
| 133 | // longer to timeout than it should. |
| 134 | ResetTimer(base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds)); |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 135 | next_state_ = STATE_SOCKS_CONNECT; |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 136 | return result; |
| 137 | } |
| 138 | |
| 139 | int SOCKSConnectJob::DoSOCKSConnect() { |
[email protected] | 81854c4 | 2010-09-22 03:39:36 | [diff] [blame] | 140 | next_state_ = STATE_SOCKS_CONNECT_COMPLETE; |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 141 | |
| 142 | // Add a SOCKS connection on top of the tcp socket. |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 143 | if (socks_params_->is_socks_v5()) { |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 144 | socket_.reset(new SOCKS5ClientSocket(transport_socket_handle_.Pass(), |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 145 | socks_params_->destination())); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 146 | } else { |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 147 | socket_.reset(new SOCKSClientSocket(transport_socket_handle_.Pass(), |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 148 | socks_params_->destination(), |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 149 | priority(), |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 150 | resolver_)); |
| 151 | } |
[email protected] | 83039bb | 2011-12-09 18:43:55 | [diff] [blame] | 152 | return socket_->Connect( |
| 153 | base::Bind(&SOCKSConnectJob::OnIOComplete, base::Unretained(this))); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | int SOCKSConnectJob::DoSOCKSConnectComplete(int result) { |
| 157 | if (result != OK) { |
| 158 | socket_->Disconnect(); |
| 159 | return result; |
| 160 | } |
| 161 | |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 162 | SetSocket(socket_.Pass()); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 163 | return result; |
| 164 | } |
| 165 | |
[email protected] | ad74a59 | 2011-01-21 18:40:55 | [diff] [blame] | 166 | int SOCKSConnectJob::ConnectInternal() { |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 167 | next_state_ = STATE_TRANSPORT_CONNECT; |
[email protected] | ad74a59 | 2011-01-21 18:40:55 | [diff] [blame] | 168 | return DoLoop(OK); |
| 169 | } |
| 170 | |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 171 | scoped_ptr<ConnectJob> |
| 172 | SOCKSClientSocketPool::SOCKSConnectJobFactory::NewConnectJob( |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 173 | const std::string& group_name, |
| 174 | const PoolBase::Request& request, |
[email protected] | 06650c5 | 2010-06-03 00:49:17 | [diff] [blame] | 175 | ConnectJob::Delegate* delegate) const { |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 176 | return scoped_ptr<ConnectJob>(new SOCKSConnectJob(group_name, |
[email protected] | 3f6007ab | 2013-08-22 19:45:39 | [diff] [blame] | 177 | request.priority(), |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 178 | request.params(), |
| 179 | ConnectionTimeout(), |
| 180 | transport_pool_, |
| 181 | host_resolver_, |
| 182 | delegate, |
| 183 | net_log_)); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | base::TimeDelta |
| 187 | SOCKSClientSocketPool::SOCKSConnectJobFactory::ConnectionTimeout() const { |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 188 | return transport_pool_->ConnectionTimeout() + |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 189 | base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds); |
| 190 | } |
| 191 | |
| 192 | SOCKSClientSocketPool::SOCKSClientSocketPool( |
| 193 | int max_sockets, |
| 194 | int max_sockets_per_group, |
[email protected] | 2431756e | 2010-09-29 20:26:13 | [diff] [blame] | 195 | ClientSocketPoolHistograms* histograms, |
[email protected] | 73c4532 | 2010-10-01 23:57:54 | [diff] [blame] | 196 | HostResolver* host_resolver, |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 197 | TransportClientSocketPool* transport_pool, |
[email protected] | 06650c5 | 2010-06-03 00:49:17 | [diff] [blame] | 198 | NetLog* net_log) |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 199 | : transport_pool_(transport_pool), |
[email protected] | 043b68c8 | 2013-08-22 23:41:52 | [diff] [blame^] | 200 | base_(this, max_sockets, max_sockets_per_group, histograms, |
[email protected] | 82b8c96 | 2011-10-12 09:17:30 | [diff] [blame] | 201 | ClientSocketPool::unused_idle_socket_timeout(), |
| 202 | ClientSocketPool::used_idle_socket_timeout(), |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 203 | new SOCKSConnectJobFactory(transport_pool, |
| 204 | host_resolver, |
| 205 | net_log)) { |
[email protected] | 51fdc7c | 2012-04-10 19:19:48 | [diff] [blame] | 206 | // We should always have a |transport_pool_| except in unit tests. |
| 207 | if (transport_pool_) |
[email protected] | 043b68c8 | 2013-08-22 23:41:52 | [diff] [blame^] | 208 | base_.AddLowerLayeredPool(transport_pool_); |
[email protected] | 66761b95 | 2010-06-25 21:30:38 | [diff] [blame] | 209 | } |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 210 | |
[email protected] | 51fdc7c | 2012-04-10 19:19:48 | [diff] [blame] | 211 | SOCKSClientSocketPool::~SOCKSClientSocketPool() { |
[email protected] | 51fdc7c | 2012-04-10 19:19:48 | [diff] [blame] | 212 | } |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 213 | |
[email protected] | 49639fa | 2011-12-20 23:22:41 | [diff] [blame] | 214 | int SOCKSClientSocketPool::RequestSocket( |
| 215 | const std::string& group_name, const void* socket_params, |
| 216 | RequestPriority priority, ClientSocketHandle* handle, |
| 217 | const CompletionCallback& callback, const BoundNetLog& net_log) { |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 218 | const scoped_refptr<SOCKSSocketParams>* casted_socket_params = |
| 219 | static_cast<const scoped_refptr<SOCKSSocketParams>*>(socket_params); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 220 | |
| 221 | return base_.RequestSocket(group_name, *casted_socket_params, priority, |
| 222 | handle, callback, net_log); |
| 223 | } |
| 224 | |
[email protected] | 2c2bef15 | 2010-10-13 00:55:03 | [diff] [blame] | 225 | void SOCKSClientSocketPool::RequestSockets( |
| 226 | const std::string& group_name, |
| 227 | const void* params, |
| 228 | int num_sockets, |
| 229 | const BoundNetLog& net_log) { |
| 230 | const scoped_refptr<SOCKSSocketParams>* casted_params = |
| 231 | static_cast<const scoped_refptr<SOCKSSocketParams>*>(params); |
| 232 | |
| 233 | base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); |
| 234 | } |
| 235 | |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 236 | void SOCKSClientSocketPool::CancelRequest(const std::string& group_name, |
[email protected] | 05ea9ff | 2010-07-15 19:08:21 | [diff] [blame] | 237 | ClientSocketHandle* handle) { |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 238 | base_.CancelRequest(group_name, handle); |
| 239 | } |
| 240 | |
[email protected] | df4b4ef | 2010-07-12 18:25:21 | [diff] [blame] | 241 | void SOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, |
[email protected] | 18ccfdb | 2013-08-15 00:13:44 | [diff] [blame] | 242 | scoped_ptr<StreamSocket> socket, |
| 243 | int id) { |
| 244 | base_.ReleaseSocket(group_name, socket.Pass(), id); |
[email protected] | a7e3857 | 2010-06-07 18:22:24 | [diff] [blame] | 245 | } |
| 246 | |
[email protected] | 7af985a | 2012-12-14 22:40:42 | [diff] [blame] | 247 | void SOCKSClientSocketPool::FlushWithError(int error) { |
| 248 | base_.FlushWithError(error); |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 249 | } |
| 250 | |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 251 | void SOCKSClientSocketPool::CloseIdleSockets() { |
| 252 | base_.CloseIdleSockets(); |
| 253 | } |
| 254 | |
[email protected] | 7cf4091 | 2010-12-09 18:25:03 | [diff] [blame] | 255 | int SOCKSClientSocketPool::IdleSocketCount() const { |
| 256 | return base_.idle_socket_count(); |
| 257 | } |
| 258 | |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 259 | int SOCKSClientSocketPool::IdleSocketCountInGroup( |
| 260 | const std::string& group_name) const { |
| 261 | return base_.IdleSocketCountInGroup(group_name); |
| 262 | } |
| 263 | |
| 264 | LoadState SOCKSClientSocketPool::GetLoadState( |
| 265 | const std::string& group_name, const ClientSocketHandle* handle) const { |
| 266 | return base_.GetLoadState(group_name, handle); |
| 267 | } |
| 268 | |
[email protected] | ea5ef4c | 2013-06-13 22:50:27 | [diff] [blame] | 269 | base::DictionaryValue* SOCKSClientSocketPool::GetInfoAsValue( |
[email protected] | ba00b49 | 2010-09-08 14:53:38 | [diff] [blame] | 270 | const std::string& name, |
| 271 | const std::string& type, |
| 272 | bool include_nested_pools) const { |
[email protected] | ea5ef4c | 2013-06-13 22:50:27 | [diff] [blame] | 273 | base::DictionaryValue* dict = base_.GetInfoAsValue(name, type); |
[email protected] | ba00b49 | 2010-09-08 14:53:38 | [diff] [blame] | 274 | if (include_nested_pools) { |
[email protected] | ea5ef4c | 2013-06-13 22:50:27 | [diff] [blame] | 275 | base::ListValue* list = new base::ListValue(); |
[email protected] | ab73904 | 2011-04-07 15:22:28 | [diff] [blame] | 276 | list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", |
| 277 | "transport_socket_pool", |
| 278 | false)); |
[email protected] | ba00b49 | 2010-09-08 14:53:38 | [diff] [blame] | 279 | dict->Set("nested_pools", list); |
| 280 | } |
| 281 | return dict; |
| 282 | } |
| 283 | |
[email protected] | 7cf4091 | 2010-12-09 18:25:03 | [diff] [blame] | 284 | base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const { |
| 285 | return base_.ConnectionTimeout(); |
| 286 | } |
| 287 | |
| 288 | ClientSocketPoolHistograms* SOCKSClientSocketPool::histograms() const { |
| 289 | return base_.histograms(); |
| 290 | }; |
| 291 | |
[email protected] | 043b68c8 | 2013-08-22 23:41:52 | [diff] [blame^] | 292 | bool SOCKSClientSocketPool::IsStalled() const { |
| 293 | return base_.IsStalled(); |
| 294 | } |
| 295 | |
| 296 | void SOCKSClientSocketPool::AddHigherLayeredPool( |
| 297 | HigherLayeredPool* higher_pool) { |
| 298 | base_.AddHigherLayeredPool(higher_pool); |
| 299 | } |
| 300 | |
| 301 | void SOCKSClientSocketPool::RemoveHigherLayeredPool( |
| 302 | HigherLayeredPool* higher_pool) { |
| 303 | base_.RemoveHigherLayeredPool(higher_pool); |
| 304 | } |
| 305 | |
[email protected] | 51fdc7c | 2012-04-10 19:19:48 | [diff] [blame] | 306 | bool SOCKSClientSocketPool::CloseOneIdleConnection() { |
| 307 | if (base_.CloseOneIdleSocket()) |
| 308 | return true; |
[email protected] | 043b68c8 | 2013-08-22 23:41:52 | [diff] [blame^] | 309 | return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
[email protected] | 51fdc7c | 2012-04-10 19:19:48 | [diff] [blame] | 310 | } |
| 311 | |
[email protected] | a796bcec | 2010-03-22 17:17:26 | [diff] [blame] | 312 | } // namespace net |