summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 03:23:13 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 03:23:13 +0000
commit501b9ba1516c6fe4aa4100104c70e2f302e0b44a (patch)
tree4b124bcc6fed8536035c4ee2b30f0fbe31248b2b /remoting/protocol
parent5f6f06b400de36fd3c302d4fc72045d4f960fde8 (diff)
downloadchromium_src-501b9ba1516c6fe4aa4100104c70e2f302e0b44a.zip
chromium_src-501b9ba1516c6fe4aa4100104c70e2f302e0b44a.tar.gz
chromium_src-501b9ba1516c6fe4aa4100104c70e2f302e0b44a.tar.bz2
Roll new libjingle. Use the new incoming_only flag in chromoting host.
BUG=81597 TEST=Unittests. Review URL: http://codereview.chromium.org/6949010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/jingle_session.cc69
-rw-r--r--remoting/protocol/jingle_session.h12
-rw-r--r--remoting/protocol/protocol_test_client.cc2
3 files changed, 62 insertions, 21 deletions
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 0f50bab..60fab26 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -23,6 +23,7 @@
#include "remoting/protocol/socket_wrapper.h"
#include "third_party/libjingle/source/talk/base/thread.h"
#include "third_party/libjingle/source/talk/p2p/base/session.h"
+#include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h"
using cricket::BaseSession;
@@ -337,23 +338,33 @@ void JingleSession::OnInitiate() {
}
// Create video RTP channels.
- video_rtp_channel_.reset(new jingle_glue::TransportChannelSocketAdapter(
- cricket_session_->CreateChannel(content_name, kVideoRtpChannelName)));
- video_rtcp_channel_.reset(new jingle_glue::TransportChannelSocketAdapter(
- cricket_session_->CreateChannel(content_name, kVideoRtcpChannelName)));
+ raw_video_rtp_channel_ =
+ cricket_session_->CreateChannel(content_name, kVideoRtpChannelName);
+ video_rtp_channel_.reset(
+ new jingle_glue::TransportChannelSocketAdapter(raw_video_rtp_channel_));
+ raw_video_rtcp_channel_ =
+ cricket_session_->CreateChannel(content_name, kVideoRtcpChannelName);
+ video_rtcp_channel_.reset(
+ new jingle_glue::TransportChannelSocketAdapter(raw_video_rtcp_channel_));
// Create control channel.
- control_channel_.reset(new jingle_glue::TransportChannelSocketAdapter(
- cricket_session_->CreateChannel(content_name, kControlChannelName)));
+ raw_control_channel_ =
+ cricket_session_->CreateChannel(content_name, kControlChannelName);
+ control_channel_.reset(
+ new jingle_glue::TransportChannelSocketAdapter(raw_control_channel_));
// Create event channel.
- event_channel_.reset(new jingle_glue::TransportChannelSocketAdapter(
- cricket_session_->CreateChannel(content_name, kEventChannelName)));
+ raw_event_channel_ =
+ cricket_session_->CreateChannel(content_name, kEventChannelName);
+ event_channel_.reset(
+ new jingle_glue::TransportChannelSocketAdapter(raw_event_channel_));
// Create video channel.
// TODO(sergeyu): Remove video channel when we are ready to switch to RTP.
- video_channel_.reset(new jingle_glue::TransportChannelSocketAdapter(
- cricket_session_->CreateChannel(content_name, kVideoChannelName)));
+ raw_video_channel_ =
+ cricket_session_->CreateChannel(content_name, kVideoChannelName);
+ video_channel_.reset(
+ new jingle_glue::TransportChannelSocketAdapter(raw_video_channel_));
if (!cricket_session_->initiator())
jingle_session_manager_->AcceptConnection(this, cricket_session_);
@@ -437,25 +448,42 @@ bool JingleSession::InitializeConfigFromDescription(
return true;
}
-bool JingleSession::InitializeChannels() {
+bool JingleSession::InitializeSSL() {
if (!EstablishSSLConnection(control_channel_.release(),
- &control_ssl_socket_)) {
+ &control_ssl_socket_)) {
LOG(ERROR) << "Establish control channel failed";
return false;
}
if (!EstablishSSLConnection(event_channel_.release(),
- &event_ssl_socket_)) {
+ &event_ssl_socket_)) {
LOG(ERROR) << "Establish event channel failed";
return false;
}
if (!EstablishSSLConnection(video_channel_.release(),
- &video_ssl_socket_)) {
+ &video_ssl_socket_)) {
LOG(ERROR) << "Establish video channel failed";
return false;
}
return true;
}
+void JingleSession::InitializeChannels() {
+ // Disable incoming connections on the host so that we don't travers
+ // the firewall.
+ if (!cricket_session_->initiator()) {
+ raw_control_channel_->GetP2PChannel()->set_incoming_only(true);
+ raw_event_channel_->GetP2PChannel()->set_incoming_only(true);
+ raw_video_channel_->GetP2PChannel()->set_incoming_only(true);
+ raw_video_rtp_channel_->GetP2PChannel()->set_incoming_only(true);
+ raw_video_rtcp_channel_->GetP2PChannel()->set_incoming_only(true);
+ }
+
+ if (!InitializeSSL()) {
+ CloseInternal(net::ERR_CONNECTION_FAILED, true);
+ return;
+ }
+}
+
void JingleSession::OnAccept() {
// If we initiated the session, store the candidate configuration that the
// host responded with, to refer to later.
@@ -467,10 +495,15 @@ void JingleSession::OnAccept() {
}
}
- if (!InitializeChannels()) {
- CloseInternal(net::ERR_CONNECTION_FAILED, true);
- return;
- }
+ // TODO(sergeyu): This is a hack: Currently set_incoming_only()
+ // needs to be called on each channel before the channel starts
+ // creating candidates but after session is accepted (after
+ // TransportChannelProxy::GetP2PChannel() starts returning actual
+ // P2P channel). By posting a task here we can call it at the right
+ // moment. This problem will go away when we switch to Pepper P2P
+ // API.
+ jingle_session_manager_->message_loop()->PostTask(
+ FROM_HERE, NewRunnableMethod(this, &JingleSession::InitializeChannels));
}
void JingleSession::OnTerminate() {
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 122aec8..3775d68 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -102,9 +102,12 @@ class JingleSession : public protocol::Session,
bool InitializeConfigFromDescription(
const cricket::SessionDescription* description);
+ // Configures channels and calls InitializeSSL().
+ void InitializeChannels();
+
// Initialize PseudoTCP + SSL on each of the video, control and input
- // channels. The channels must have been created before this is called.
- bool InitializeChannels();
+ // channels. The channels must have been created before this is called.
+ bool InitializeSSL();
// Helper method to create and initialize PseudoTCP + SSL socket on
// top of the provided |channel|. The resultant SSL socket is
@@ -163,12 +166,15 @@ class JingleSession : public protocol::Session,
// |control_channel_| holds a channel until SSL socket is
// created. After that |control_ssl_socket_| owns the channel. The
// same is the case fo |event_channel_| and |video_channel_|.
+ cricket::TransportChannel* raw_control_channel_;
scoped_ptr<jingle_glue::TransportChannelSocketAdapter> control_channel_;
scoped_ptr<SocketWrapper> control_ssl_socket_;
+ cricket::TransportChannel* raw_event_channel_;
scoped_ptr<jingle_glue::TransportChannelSocketAdapter> event_channel_;
scoped_ptr<SocketWrapper> event_ssl_socket_;
+ cricket::TransportChannel* raw_video_channel_;
scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_channel_;
scoped_ptr<SocketWrapper> video_ssl_socket_;
@@ -178,7 +184,9 @@ class JingleSession : public protocol::Session,
// Used to verify the certificate received in SSLClientSocket.
scoped_ptr<net::CertVerifier> cert_verifier_;
+ cricket::TransportChannel* raw_video_rtp_channel_;
scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_rtp_channel_;
+ cricket::TransportChannel* raw_video_rtcp_channel_;
scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_rtcp_channel_;
// Callback called by the SSL layer.
diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc
index c481ca5..9d01c32 100644
--- a/remoting/protocol/protocol_test_client.cc
+++ b/remoting/protocol/protocol_test_client.cc
@@ -230,7 +230,7 @@ void ProtocolTestClient::Run(const std::string& username,
new XmppSignalStrategy(&jingle_thread, username, auth_token,
kChromotingTokenServiceName));
client_ = new JingleClient(&jingle_thread, signal_strategy_.get(),
- NULL, this);
+ NULL, NULL, NULL, this);
client_->Init();
session_manager_ = new JingleSessionManager(&jingle_thread);