| 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 #include "remoting/jingle_glue/utils.h" | 16 #include "remoting/jingle_glue/utils.h" |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 | 19 |
| 19 SSLSocketAdapter* SSLSocketAdapter::Create(AsyncSocket* socket) { | 20 SSLSocketAdapter* SSLSocketAdapter::Create(AsyncSocket* socket) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return net::ERR_UNEXPECTED; | 61 return net::ERR_UNEXPECTED; |
| 61 } | 62 } |
| 62 | 63 |
| 63 // SSLConfigService is not thread-safe, and the default values for SSLConfig | 64 // SSLConfigService is not thread-safe, and the default values for SSLConfig |
| 64 // are correct for us, so we don't use the config service to initialize this | 65 // are correct for us, so we don't use the config service to initialize this |
| 65 // object. | 66 // object. |
| 66 net::SSLConfig ssl_config; | 67 net::SSLConfig ssl_config; |
| 67 transport_socket_->set_addr(talk_base::SocketAddress(hostname_, 0)); | 68 transport_socket_->set_addr(talk_base::SocketAddress(hostname_, 0)); |
| 68 ssl_socket_.reset( | 69 ssl_socket_.reset( |
| 69 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 70 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
| 70 transport_socket_, hostname_.c_str(), ssl_config, | 71 transport_socket_, net::HostPortPair(hostname_, 443), ssl_config, |
| 71 NULL /* ssl_host_info */)); | 72 NULL /* ssl_host_info */)); |
| 72 | 73 |
| 73 int result = ssl_socket_->Connect(&connected_callback_); | 74 int result = ssl_socket_->Connect(&connected_callback_); |
| 74 | 75 |
| 75 if (result == net::ERR_IO_PENDING || result == net::OK) { | 76 if (result == net::ERR_IO_PENDING || result == net::OK) { |
| 76 return 0; | 77 return 0; |
| 77 } else { | 78 } else { |
| 78 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); | 79 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); |
| 79 return result; | 80 return result; |
| 80 } | 81 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 write_buffer_len_ = buffer_len; | 346 write_buffer_len_ = buffer_len; |
| 346 return; | 347 return; |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 was_used_to_convey_data_ = true; | 350 was_used_to_convey_data_ = true; |
| 350 callback->RunWithParams(Tuple1<int>(result)); | 351 callback->RunWithParams(Tuple1<int>(result)); |
| 351 } | 352 } |
| 352 } | 353 } |
| 353 | 354 |
| 354 } // namespace remoting | 355 } // namespace remoting |
| OLD | NEW |