OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "jingle/notifier/base/proxy_resolving_client_socket.h" | 5 #include "jingle/notifier/base/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 CloseTransportSocket(); | 165 CloseTransportSocket(); |
166 RunUserConnectCallback(status); | 166 RunUserConnectCallback(status); |
167 return; | 167 return; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 transport_.reset(new net::ClientSocketHandle); | 171 transport_.reset(new net::ClientSocketHandle); |
172 // Now that we have resolved the proxy, we need to connect. | 172 // Now that we have resolved the proxy, we need to connect. |
173 status = net::InitSocketHandleForRawConnect( | 173 status = net::InitSocketHandleForRawConnect( |
174 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_, | 174 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_, |
175 ssl_config_, bound_net_log_, transport_.get(), connect_callback_); | 175 ssl_config_, bound_net_log_, transport_.get(), connect_callback_, |
176 base::Bind(&ProxyResolvingClientSocket::OnNeedsProxyTunnelAuthCallback, | |
177 base::Unretained(this))); | |
176 if (status != net::ERR_IO_PENDING) { | 178 if (status != net::ERR_IO_PENDING) { |
177 // Since this method is always called asynchronously. it is OK to call | 179 // Since this method is always called asynchronously. it is OK to call |
178 // ProcessConnectDone synchronously. | 180 // ProcessConnectDone synchronously. |
179 ProcessConnectDone(status); | 181 ProcessConnectDone(status); |
180 } | 182 } |
181 } | 183 } |
182 | 184 |
185 void ProxyResolvingClientSocket::OnNeedsProxyTunnelAuthCallback( | |
186 const net::HttpResponseInfo& response_info, | |
187 net::HttpAuthController* auth_controller, | |
188 net::CompletionCallback callback) { | |
189 // TODO(rch): figure out what to do here | |
cbentzel
2012/01/18 12:14:22
Do you want to figure this out prior to landing th
akalin
2012/01/19 21:07:37
so I tried to trace through what 'regular' sockets
Ryan Hamilton
2012/01/19 23:11:19
Done.
Ryan Hamilton
2012/01/19 23:11:19
Done.
| |
190 callback.Run(net::OK); | |
191 } | |
192 | |
183 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { | 193 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { |
184 if (status != net::OK) { | 194 if (status != net::OK) { |
185 // If the connection fails, try another proxy. | 195 // If the connection fails, try another proxy. |
186 status = ReconsiderProxyAfterError(status); | 196 status = ReconsiderProxyAfterError(status); |
187 // ReconsiderProxyAfterError either returns an error (in which case it is | 197 // ReconsiderProxyAfterError either returns an error (in which case it is |
188 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering | 198 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering |
189 // another proxy. | 199 // another proxy. |
190 DCHECK_NE(status, net::OK); | 200 DCHECK_NE(status, net::OK); |
191 if (status == net::ERR_IO_PENDING) | 201 if (status == net::ERR_IO_PENDING) |
192 // Proxy reconsideration pending. Return. | 202 // Proxy reconsideration pending. Return. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 return base::TimeDelta::FromMicroseconds(-1); | 376 return base::TimeDelta::FromMicroseconds(-1); |
367 } | 377 } |
368 | 378 |
369 void ProxyResolvingClientSocket::CloseTransportSocket() { | 379 void ProxyResolvingClientSocket::CloseTransportSocket() { |
370 if (transport_.get() && transport_->socket()) | 380 if (transport_.get() && transport_->socket()) |
371 transport_->socket()->Disconnect(); | 381 transport_->socket()->Disconnect(); |
372 transport_.reset(); | 382 transport_.reset(); |
373 } | 383 } |
374 | 384 |
375 } // namespace notifier | 385 } // namespace notifier |
OLD | NEW |