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 "jingle/glue/proxy_resolving_client_socket.h" | 5 #include "jingle/glue/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 tried_direct_connect_fallback_ = false; | 139 tried_direct_connect_fallback_ = false; |
140 | 140 |
141 // First we try and resolve the proxy. | 141 // First we try and resolve the proxy. |
142 int status = network_session_->proxy_service()->ResolveProxy( | 142 int status = network_session_->proxy_service()->ResolveProxy( |
143 proxy_url_, | 143 proxy_url_, |
144 net::LOAD_NORMAL, | 144 net::LOAD_NORMAL, |
145 &proxy_info_, | 145 &proxy_info_, |
146 proxy_resolve_callback_, | 146 proxy_resolve_callback_, |
147 &pac_request_, | 147 &pac_request_, |
148 NULL, | 148 nullptr, |
bengr
2016/02/16 20:00:13
NULL, std::string()
RyanSturm
2016/02/17 21:46:11
Done.
| |
149 "", | |
149 bound_net_log_); | 150 bound_net_log_); |
150 if (status != net::ERR_IO_PENDING) { | 151 if (status != net::ERR_IO_PENDING) { |
151 // We defer execution of ProcessProxyResolveDone instead of calling it | 152 // We defer execution of ProcessProxyResolveDone instead of calling it |
152 // directly here for simplicity. From the caller's point of view, | 153 // directly here for simplicity. From the caller's point of view, |
153 // the connect always happens asynchronously. | 154 // the connect always happens asynchronously. |
154 base::MessageLoop* message_loop = base::MessageLoop::current(); | 155 base::MessageLoop* message_loop = base::MessageLoop::current(); |
155 CHECK(message_loop); | 156 CHECK(message_loop); |
156 message_loop->PostTask( | 157 message_loop->PostTask( |
157 FROM_HERE, | 158 FROM_HERE, |
158 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone, | 159 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 return error; | 287 return error; |
287 } | 288 } |
288 | 289 |
289 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { | 290 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { |
290 network_session_->ssl_client_auth_cache()->Remove( | 291 network_session_->ssl_client_auth_cache()->Remove( |
291 proxy_info_.proxy_server().host_port_pair()); | 292 proxy_info_.proxy_server().host_port_pair()); |
292 } | 293 } |
293 | 294 |
294 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( | 295 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( |
295 proxy_url_, net::LOAD_NORMAL, error, &proxy_info_, | 296 proxy_url_, net::LOAD_NORMAL, error, &proxy_info_, |
296 proxy_resolve_callback_, &pac_request_, NULL, bound_net_log_); | 297 proxy_resolve_callback_, &pac_request_, nullptr, "", bound_net_log_); |
bengr
2016/02/16 20:00:13
NULL, std::string()
RyanSturm
2016/02/17 21:46:11
Done.
| |
297 if (rv == net::OK || rv == net::ERR_IO_PENDING) { | 298 if (rv == net::OK || rv == net::ERR_IO_PENDING) { |
298 CloseTransportSocket(); | 299 CloseTransportSocket(); |
299 } else { | 300 } else { |
300 // If ReconsiderProxyAfterError() failed synchronously, it means | 301 // If ReconsiderProxyAfterError() failed synchronously, it means |
301 // there was nothing left to fall-back to, so fail the transaction | 302 // there was nothing left to fall-back to, so fail the transaction |
302 // with the last connection error we got. | 303 // with the last connection error we got. |
303 rv = error; | 304 rv = error; |
304 } | 305 } |
305 | 306 |
306 // We either have new proxy info or there was an error in falling back. | 307 // We either have new proxy info or there was an error in falling back. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 return 0; | 434 return 0; |
434 } | 435 } |
435 | 436 |
436 void ProxyResolvingClientSocket::CloseTransportSocket() { | 437 void ProxyResolvingClientSocket::CloseTransportSocket() { |
437 if (transport_.get() && transport_->socket()) | 438 if (transport_.get() && transport_->socket()) |
438 transport_->socket()->Disconnect(); | 439 transport_->socket()->Disconnect(); |
439 transport_.reset(); | 440 transport_.reset(); |
440 } | 441 } |
441 | 442 |
442 } // namespace jingle_glue | 443 } // namespace jingle_glue |
OLD | NEW |