summaryrefslogtreecommitdiffstats
path: root/remoting
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
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')
-rw-r--r--remoting/host/chromoting_host.cc3
-rw-r--r--remoting/jingle_glue/jingle_client.cc15
-rw-r--r--remoting/jingle_glue/jingle_client.h6
-rw-r--r--remoting/jingle_glue/jingle_client_unittest.cc4
-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
7 files changed, 66 insertions, 45 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 28e28d9..ceca4f6 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -104,8 +104,7 @@ void ChromotingHost::Start(Task* shutdown_task) {
kChromotingTokenServiceName));
jingle_client_ = new JingleClient(context_->jingle_thread(),
signal_strategy_.get(),
- NULL,
- this);
+ NULL, NULL, NULL, this);
jingle_client_->Init();
}
diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc
index b7b27c4..c2f9cd7 100644
--- a/remoting/jingle_glue/jingle_client.cc
+++ b/remoting/jingle_glue/jingle_client.cc
@@ -167,21 +167,6 @@ JavascriptIqRequest* JavascriptSignalStrategy::CreateIqRequest() {
JingleClient::JingleClient(JingleThread* thread,
SignalStrategy* signal_strategy,
- PortAllocatorSessionFactory* session_factory,
- Callback* callback)
- : enable_nat_traversing_(false),
- thread_(thread),
- state_(START),
- initialized_(false),
- closed_(false),
- initialized_finished_(false),
- callback_(callback),
- signal_strategy_(signal_strategy),
- port_allocator_session_factory_(session_factory) {
-}
-
-JingleClient::JingleClient(JingleThread* thread,
- SignalStrategy* signal_strategy,
talk_base::NetworkManager* network_manager,
talk_base::PacketSocketFactory* socket_factory,
PortAllocatorSessionFactory* session_factory,
diff --git a/remoting/jingle_glue/jingle_client.h b/remoting/jingle_glue/jingle_client.h
index a1d6806..cb7e2d3 100644
--- a/remoting/jingle_glue/jingle_client.h
+++ b/remoting/jingle_glue/jingle_client.h
@@ -137,14 +137,10 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>,
};
// Physical sockets are used if |network_manager| and
- // |socket_factory| are not specified. Otherwise ownership of these
+ // |socket_factory| are set to NULL. Otherwise ownership of these
// objects is given to JingleClient.
JingleClient(JingleThread* thread,
SignalStrategy* signal_strategy,
- PortAllocatorSessionFactory* session_factory,
- Callback* callback);
- JingleClient(JingleThread* thread,
- SignalStrategy* signal_strategy,
talk_base::NetworkManager* network_manager,
talk_base::PacketSocketFactory* socket_factory,
PortAllocatorSessionFactory* session_factory,
diff --git a/remoting/jingle_glue/jingle_client_unittest.cc b/remoting/jingle_glue/jingle_client_unittest.cc
index 938e0a3..e6e79a3 100644
--- a/remoting/jingle_glue/jingle_client_unittest.cc
+++ b/remoting/jingle_glue/jingle_client_unittest.cc
@@ -41,8 +41,8 @@ class JingleClientTest : public testing::Test {
virtual void SetUp() {
signal_strategy_.reset(new XmppSignalStrategy(&thread_, "", "", ""));
client_ = new JingleClient(&thread_, signal_strategy_.get(), NULL,
- &callback_);
- // Fake initialization
+ NULL, NULL, &callback_);
+ // Fake initialization.
client_->initialized_ = true;
signal_strategy_->observer_ = client_;
}
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);