| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/jingle_glue/ssl_socket_adapter.h" | 5 #include "remoting/jingle_glue/ssl_socket_adapter.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
| 10 #include "net/base/host_port_pair.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 11 #include "net/base/ssl_config_service.h" | 12 #include "net/base/ssl_config_service.h" |
| 12 #include "net/base/sys_addrinfo.h" | 13 #include "net/base/sys_addrinfo.h" |
| 13 #include "net/socket/client_socket_factory.h" | 14 #include "net/socket/client_socket_factory.h" |
| 14 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
| 15 | 16 |
| 16 namespace remoting { | 17 namespace remoting { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return net::ERR_UNEXPECTED; | 95 return net::ERR_UNEXPECTED; |
| 95 } | 96 } |
| 96 | 97 |
| 97 // SSLConfigService is not thread-safe, and the default values for SSLConfig | 98 // SSLConfigService is not thread-safe, and the default values for SSLConfig |
| 98 // are correct for us, so we don't use the config service to initialize this | 99 // are correct for us, so we don't use the config service to initialize this |
| 99 // object. | 100 // object. |
| 100 net::SSLConfig ssl_config; | 101 net::SSLConfig ssl_config; |
| 101 transport_socket_->set_addr(talk_base::SocketAddress(hostname_, 0)); | 102 transport_socket_->set_addr(talk_base::SocketAddress(hostname_, 0)); |
| 102 ssl_socket_.reset( | 103 ssl_socket_.reset( |
| 103 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 104 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
| 104 transport_socket_, hostname_.c_str(), ssl_config)); | 105 transport_socket_, |
| 106 net::HostPortPair(hostname_, socket_->GetRemoteAddress().port()), |
| 107 ssl_config)); |
| 105 | 108 |
| 106 int result = ssl_socket_->Connect(&connected_callback_); | 109 int result = ssl_socket_->Connect(&connected_callback_); |
| 107 | 110 |
| 108 if (result == net::ERR_IO_PENDING || result == net::OK) { | 111 if (result == net::ERR_IO_PENDING || result == net::OK) { |
| 109 return 0; | 112 return 0; |
| 110 } else { | 113 } else { |
| 111 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); | 114 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); |
| 112 return result; | 115 return result; |
| 113 } | 116 } |
| 114 } | 117 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 write_buffer_ = buffer; | 353 write_buffer_ = buffer; |
| 351 write_buffer_len_ = buffer_len; | 354 write_buffer_len_ = buffer_len; |
| 352 return; | 355 return; |
| 353 } | 356 } |
| 354 } | 357 } |
| 355 callback->RunWithParams(Tuple1<int>(result)); | 358 callback->RunWithParams(Tuple1<int>(result)); |
| 356 } | 359 } |
| 357 } | 360 } |
| 358 | 361 |
| 359 } // namespace remoting | 362 } // namespace remoting |
| OLD | NEW |