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