summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 20:57:03 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 20:57:03 +0000
commit9bb6c7af5eeef694d2e7a81e9fe14dfa9d06f12d (patch)
tree8f70402860b4a55b1767054bb75349f24eb73745 /remoting
parentb4a45ead66998bf97d96a76b9b1b40dd498ac6c0 (diff)
downloadchromium_src-9bb6c7af5eeef694d2e7a81e9fe14dfa9d06f12d.zip
chromium_src-9bb6c7af5eeef694d2e7a81e9fe14dfa9d06f12d.tar.gz
chromium_src-9bb6c7af5eeef694d2e7a81e9fe14dfa9d06f12d.tar.bz2
Chromoting: Disable NAT traversing
BUG=None TEST=None Review URL: http://codereview.chromium.org/6785002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/jingle_glue/jingle_client.cc22
-rw-r--r--remoting/jingle_glue/jingle_client.h6
2 files changed, 21 insertions, 7 deletions
diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc
index d216ff7..538b05b 100644
--- a/remoting/jingle_glue/jingle_client.cc
+++ b/remoting/jingle_glue/jingle_client.cc
@@ -185,7 +185,8 @@ JingleClient::JingleClient(JingleThread* thread,
talk_base::PacketSocketFactory* socket_factory,
PortAllocatorSessionFactory* session_factory,
Callback* callback)
- : thread_(thread),
+ : enable_nat_traversing_(false),
+ thread_(thread),
state_(START),
initialized_(false),
closed_(false),
@@ -230,6 +231,11 @@ void JingleClient::DoInitialize() {
new remoting::HttpPortAllocator(
network_manager_.get(), socket_factory_.get(),
port_allocator_session_factory_.get(), "transp2"));
+ if (!enable_nat_traversing_) {
+ port_allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_STUN |
+ cricket::PORTALLOCATOR_DISABLE_RELAY |
+ cricket::PORTALLOCATOR_DISABLE_TCP);
+ }
// TODO(ajwong): The strategy needs a "start" command or something. Right
// now, Init() implicitly starts processing events. Thus, we must have the
@@ -237,12 +243,14 @@ void JingleClient::DoInitialize() {
// may occur and callback into class before we're done initializing.
signal_strategy_->Init(this);
- jingle_info_request_.reset(
- new JingleInfoRequest(signal_strategy_->CreateIqRequest()));
- jingle_info_request_->SetCallback(
- NewCallback(this, &JingleClient::OnJingleInfo));
- jingle_info_request_->Run(
- NewRunnableMethod(this, &JingleClient::DoStartSession));
+ if (enable_nat_traversing_) {
+ jingle_info_request_.reset(
+ new JingleInfoRequest(signal_strategy_->CreateIqRequest()));
+ jingle_info_request_->SetCallback(
+ NewCallback(this, &JingleClient::OnJingleInfo));
+ jingle_info_request_->Run(
+ NewRunnableMethod(this, &JingleClient::DoStartSession));
+ }
}
void JingleClient::DoStartSession() {
diff --git a/remoting/jingle_glue/jingle_client.h b/remoting/jingle_glue/jingle_client.h
index 851525e..027a8d3 100644
--- a/remoting/jingle_glue/jingle_client.h
+++ b/remoting/jingle_glue/jingle_client.h
@@ -197,6 +197,12 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>,
const std::vector<std::string>& relay_hosts,
const std::vector<talk_base::SocketAddress>& stun_hosts);
+ // This must be set to true to enable NAT traversal. STUN/Relay
+ // servers are not used when NAT traversal is disabled, so P2P
+ // connection will works only when both peers are on the same
+ // network.
+ bool enable_nat_traversing_;
+
// JingleThread used for the connection. Set in the constructor.
JingleThread* thread_;