Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: jingle/notifier/base/proxy_resolving_client_socket.cc

Issue 10389098: [Sync] Make ChromeAsyncSocket use only the hostname on connect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 26 matching lines...) Expand all
37 tried_direct_connect_fallback_(false), 37 tried_direct_connect_fallback_(false),
38 bound_net_log_( 38 bound_net_log_(
39 net::BoundNetLog::Make( 39 net::BoundNetLog::Make(
40 request_context_getter->GetURLRequestContext()->net_log(), 40 request_context_getter->GetURLRequestContext()->net_log(),
41 net::NetLog::SOURCE_SOCKET)), 41 net::NetLog::SOURCE_SOCKET)),
42 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 42 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
43 DCHECK(request_context_getter); 43 DCHECK(request_context_getter);
44 net::URLRequestContext* request_context = 44 net::URLRequestContext* request_context =
45 request_context_getter->GetURLRequestContext(); 45 request_context_getter->GetURLRequestContext();
46 DCHECK(request_context); 46 DCHECK(request_context);
47 DCHECK(!dest_host_port_pair_.host().empty());
48 DCHECK_GT(dest_host_port_pair_.port(), 0);
47 net::HttpNetworkSession::Params session_params; 49 net::HttpNetworkSession::Params session_params;
48 session_params.client_socket_factory = socket_factory; 50 session_params.client_socket_factory = socket_factory;
49 session_params.host_resolver = request_context->host_resolver(); 51 session_params.host_resolver = request_context->host_resolver();
50 session_params.cert_verifier = request_context->cert_verifier(); 52 session_params.cert_verifier = request_context->cert_verifier();
51 // TODO(rkn): This is NULL because ServerBoundCertService is not thread safe. 53 // TODO(rkn): This is NULL because ServerBoundCertService is not thread safe.
52 session_params.server_bound_cert_service = NULL; 54 session_params.server_bound_cert_service = NULL;
53 // transport_security_state is NULL because it's not thread safe. 55 // transport_security_state is NULL because it's not thread safe.
54 session_params.transport_security_state = NULL; 56 session_params.transport_security_state = NULL;
55 session_params.proxy_service = request_context->proxy_service(); 57 session_params.proxy_service = request_context->proxy_service();
56 session_params.ssl_host_info_factory = NULL; 58 session_params.ssl_host_info_factory = NULL;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 103 }
102 104
103 int ProxyResolvingClientSocket::Connect( 105 int ProxyResolvingClientSocket::Connect(
104 const net::CompletionCallback& callback) { 106 const net::CompletionCallback& callback) {
105 DCHECK(user_connect_callback_.is_null()); 107 DCHECK(user_connect_callback_.is_null());
106 108
107 tried_direct_connect_fallback_ = false; 109 tried_direct_connect_fallback_ = false;
108 110
109 // First we try and resolve the proxy. 111 // First we try and resolve the proxy.
110 GURL url("http://" + dest_host_port_pair_.ToString()); 112 GURL url("http://" + dest_host_port_pair_.ToString());
113 DCHECK(url.is_valid());
111 int status = network_session_->proxy_service()->ResolveProxy( 114 int status = network_session_->proxy_service()->ResolveProxy(
112 url, 115 url,
113 &proxy_info_, 116 &proxy_info_,
114 proxy_resolve_callback_, 117 proxy_resolve_callback_,
115 &pac_request_, 118 &pac_request_,
116 bound_net_log_); 119 bound_net_log_);
117 if (status != net::ERR_IO_PENDING) { 120 if (status != net::ERR_IO_PENDING) {
118 // We defer execution of ProcessProxyResolveDone instead of calling it 121 // We defer execution of ProcessProxyResolveDone instead of calling it
119 // directly here for simplicity. From the caller's point of view, 122 // directly here for simplicity. From the caller's point of view,
120 // the connect always happens asynchronously. 123 // the connect always happens asynchronously.
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 return net::kProtoUnknown; 376 return net::kProtoUnknown;
374 } 377 }
375 378
376 void ProxyResolvingClientSocket::CloseTransportSocket() { 379 void ProxyResolvingClientSocket::CloseTransportSocket() {
377 if (transport_.get() && transport_->socket()) 380 if (transport_.get() && transport_->socket())
378 transport_->socket()->Disconnect(); 381 transport_->socket()->Disconnect();
379 transport_.reset(); 382 transport_.reset();
380 } 383 }
381 384
382 } // namespace notifier 385 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/base/proxy_resolving_client_socket.h ('k') | jingle/notifier/base/xmpp_client_socket_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698