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_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "crypto/rsa_private_key.h" | 8 #include "crypto/rsa_private_key.h" |
9 #include "jingle/glue/channel_socket_adapter.h" | 9 #include "jingle/glue/channel_socket_adapter.h" |
10 #include "jingle/glue/pseudotcp_adapter.h" | 10 #include "jingle/glue/pseudotcp_adapter.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 SetState(CONNECTING); | 374 SetState(CONNECTING); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 bool JingleSession::EstablishSSLConnection( | 378 bool JingleSession::EstablishSSLConnection( |
379 net::Socket* channel, scoped_ptr<SocketWrapper>* ssl_socket) { | 379 net::Socket* channel, scoped_ptr<SocketWrapper>* ssl_socket) { |
380 jingle_glue::PseudoTcpAdapter* pseudotcp = | 380 jingle_glue::PseudoTcpAdapter* pseudotcp = |
381 new jingle_glue::PseudoTcpAdapter(channel); | 381 new jingle_glue::PseudoTcpAdapter(channel); |
382 pseudotcp->Connect(&connect_callback_); | 382 pseudotcp->Connect(&connect_callback_); |
383 | 383 |
| 384 // TODO(wez): We shouldn't try to start SSL until the socket we're |
| 385 // starting it on is connected. |
384 if (cricket_session_->initiator()) { | 386 if (cricket_session_->initiator()) { |
385 // Create client SSL socket. | 387 // Create client SSL socket. |
386 net::SSLClientSocket* socket = CreateSSLClientSocket( | 388 net::SSLClientSocket* socket = CreateSSLClientSocket( |
387 pseudotcp, server_cert_, cert_verifier_.get()); | 389 pseudotcp, server_cert_, cert_verifier_.get()); |
388 ssl_socket->reset(new SocketWrapper(socket)); | 390 ssl_socket->reset(new SocketWrapper(socket)); |
389 | 391 |
390 int ret = socket->Connect(&ssl_connect_callback_); | 392 int ret = socket->Connect(&ssl_connect_callback_); |
391 if (ret == net::ERR_IO_PENDING) { | 393 if (ret == net::ERR_IO_PENDING) { |
392 return true; | 394 return true; |
393 } else if (ret != net::OK) { | 395 } else if (ret != net::OK) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 544 |
543 state_ = new_state; | 545 state_ = new_state; |
544 if (!closed_ && state_change_callback_.get()) | 546 if (!closed_ && state_change_callback_.get()) |
545 state_change_callback_->Run(new_state); | 547 state_change_callback_->Run(new_state); |
546 } | 548 } |
547 } | 549 } |
548 | 550 |
549 } // namespace protocol | 551 } // namespace protocol |
550 | 552 |
551 } // namespace remoting | 553 } // namespace remoting |
OLD | NEW |