Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: remoting/jingle_glue/chromium_port_allocator.cc

Issue 209323002: New policies: enable/disable relay; port range (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed android build. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/jingle_glue/network_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/jingle_glue/chromium_port_allocator.h" 5 #include "remoting/jingle_glue/chromium_port_allocator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/http/http_status_code.h" 10 #include "net/http/http_status_code.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 new ChromiumPortAllocator(url_context, network_manager.Pass(), 140 new ChromiumPortAllocator(url_context, network_manager.Pass(),
141 socket_factory.Pass())); 141 socket_factory.Pass()));
142 142
143 // We always use PseudoTcp to provide a reliable channel. It provides poor 143 // We always use PseudoTcp to provide a reliable channel. It provides poor
144 // performance when combined with TCP-based transport, so we have to disable 144 // performance when combined with TCP-based transport, so we have to disable
145 // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username 145 // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username
146 // fragment is shared between all candidates for this channel. 146 // fragment is shared between all candidates for this channel.
147 int flags = cricket::PORTALLOCATOR_DISABLE_TCP | 147 int flags = cricket::PORTALLOCATOR_DISABLE_TCP |
148 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | 148 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
149 cricket::PORTALLOCATOR_ENABLE_IPV6; 149 cricket::PORTALLOCATOR_ENABLE_IPV6;
150 if (network_settings.nat_traversal_mode != 150
151 NetworkSettings::NAT_TRAVERSAL_ENABLED) { 151 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_STUN))
152 flags |= cricket::PORTALLOCATOR_DISABLE_STUN | 152 flags |= cricket::PORTALLOCATOR_DISABLE_STUN;
153 cricket::PORTALLOCATOR_DISABLE_RELAY; 153
154 } 154 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_RELAY))
155 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY;
156
155 result->set_flags(flags); 157 result->set_flags(flags);
156 result->SetPortRange(network_settings.min_port, 158 result->SetPortRange(network_settings.min_port,
157 network_settings.max_port); 159 network_settings.max_port);
158 160
159 return result.Pass(); 161 return result.Pass();
160 } 162 }
161 163
162 ChromiumPortAllocator::ChromiumPortAllocator( 164 ChromiumPortAllocator::ChromiumPortAllocator(
163 const scoped_refptr<net::URLRequestContextGetter>& url_context, 165 const scoped_refptr<net::URLRequestContextGetter>& url_context,
164 scoped_ptr<talk_base::NetworkManager> network_manager, 166 scoped_ptr<talk_base::NetworkManager> network_manager,
(...skipping 12 matching lines...) Expand all
177 const std::string& content_name, 179 const std::string& content_name,
178 int component, 180 int component,
179 const std::string& ice_username_fragment, 181 const std::string& ice_username_fragment,
180 const std::string& ice_password) { 182 const std::string& ice_password) {
181 return new ChromiumPortAllocatorSession( 183 return new ChromiumPortAllocatorSession(
182 this, content_name, component, ice_username_fragment, ice_password, 184 this, content_name, component, ice_username_fragment, ice_password,
183 stun_hosts(), relay_hosts(), relay_token(), url_context_); 185 stun_hosts(), relay_hosts(), relay_token(), url_context_);
184 } 186 }
185 187
186 } // namespace remoting 188 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/jingle_glue/network_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698