| 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 "remoting/protocol/jingle_stream_connector.h" | 5 #include "remoting/protocol/jingle_stream_connector.h" |
| 6 | 6 |
| 7 #include "jingle/glue/channel_socket_adapter.h" | 7 #include "jingle/glue/channel_socket_adapter.h" |
| 8 #include "jingle/glue/pseudotcp_adapter.h" | 8 #include "jingle/glue/pseudotcp_adapter.h" |
| 9 #include "net/base/cert_status_flags.h" | 9 #include "net/base/cert_status_flags.h" |
| 10 #include "net/base/cert_verifier.h" | 10 #include "net/base/cert_verifier.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace protocol { | 21 namespace protocol { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Value is choosen to balance the extra latency against the reduced | 25 // Value is choosen to balance the extra latency against the reduced |
| 26 // load due to ACK traffic. | 26 // load due to ACK traffic. |
| 27 const int kTcpAckDelayMilliseconds = 10; | 27 const int kTcpAckDelayMilliseconds = 10; |
| 28 | 28 |
| 29 // Helper method to create a SSL client socket. | 29 // Helper method to create a SSL client socket. |
| 30 net::SSLClientSocket* CreateSSLClientSocket( | 30 net::SSLClientSocket* CreateSSLClientSocket( |
| 31 net::StreamSocket* socket, const std::string& cert_der, | 31 net::StreamSocket* socket, const std::string& der_cert, |
| 32 net::CertVerifier* cert_verifier) { | 32 net::CertVerifier* cert_verifier) { |
| 33 net::SSLConfig ssl_config; | 33 net::SSLConfig ssl_config; |
| 34 | 34 |
| 35 // Certificate provided by the host doesn't need authority. | 35 // Certificate provided by the host doesn't need authority. |
| 36 net::SSLConfig::CertAndStatus cert_and_status; | 36 net::SSLConfig::CertAndStatus cert_and_status; |
| 37 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; | 37 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; |
| 38 cert_and_status.cert = net::X509Certificate::CreateFromBytes( | 38 cert_and_status.der_cert = der_cert; |
| 39 cert_der.data(), cert_der.length()); | |
| 40 ssl_config.allowed_bad_certs.push_back(cert_and_status); | 39 ssl_config.allowed_bad_certs.push_back(cert_and_status); |
| 41 | 40 |
| 42 // SSLClientSocket takes ownership of the adapter. | 41 // SSLClientSocket takes ownership of the adapter. |
| 43 net::HostPortPair host_and_pair(JingleSession::kChromotingContentName, 0); | 42 net::HostPortPair host_and_pair(JingleSession::kChromotingContentName, 0); |
| 44 net::SSLClientSocket* ssl_socket = | 43 net::SSLClientSocket* ssl_socket = |
| 45 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 44 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
| 46 socket, host_and_pair, ssl_config, NULL, cert_verifier); | 45 socket, host_and_pair, ssl_config, NULL, cert_verifier); |
| 47 return ssl_socket; | 46 return ssl_socket; |
| 48 } | 47 } |
| 49 | 48 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 188 } |
| 190 | 189 |
| 191 void JingleStreamConnector::NotifyError() { | 190 void JingleStreamConnector::NotifyError() { |
| 192 socket_.reset(); | 191 socket_.reset(); |
| 193 callback_.Run(name_, NULL); | 192 callback_.Run(name_, NULL); |
| 194 session_->OnChannelConnectorFinished(name_, this); | 193 session_->OnChannelConnectorFinished(name_, this); |
| 195 } | 194 } |
| 196 | 195 |
| 197 } // namespace protocol | 196 } // namespace protocol |
| 198 } // namespace remoting | 197 } // namespace remoting |
| OLD | NEW |