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

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: Created 6 years, 9 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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (network_settings.nat_traversal_mode !=
151 NetworkSettings::NAT_TRAVERSAL_ENABLED) { 151 NetworkSettings::NAT_TRAVERSAL_ENABLED) {
152 flags |= cricket::PORTALLOCATOR_DISABLE_STUN | 152 if (network_settings.nat_traversal_mode ==
153 cricket::PORTALLOCATOR_DISABLE_RELAY; 153 NetworkSettings::NAT_TRAVERSAL_ENABLED_NO_RELAY) {
154 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY;
155 } else {
156 flags |= cricket::PORTALLOCATOR_DISABLE_STUN |
157 cricket::PORTALLOCATOR_DISABLE_RELAY;
158 }
154 } 159 }
155 result->set_flags(flags); 160 result->set_flags(flags);
156 result->SetPortRange(network_settings.min_port, 161 result->SetPortRange(network_settings.min_port,
157 network_settings.max_port); 162 network_settings.max_port);
158 163
159 return result.Pass(); 164 return result.Pass();
160 } 165 }
161 166
162 ChromiumPortAllocator::ChromiumPortAllocator( 167 ChromiumPortAllocator::ChromiumPortAllocator(
163 const scoped_refptr<net::URLRequestContextGetter>& url_context, 168 const scoped_refptr<net::URLRequestContextGetter>& url_context,
(...skipping 13 matching lines...) Expand all
177 const std::string& content_name, 182 const std::string& content_name,
178 int component, 183 int component,
179 const std::string& ice_username_fragment, 184 const std::string& ice_username_fragment,
180 const std::string& ice_password) { 185 const std::string& ice_password) {
181 return new ChromiumPortAllocatorSession( 186 return new ChromiumPortAllocatorSession(
182 this, content_name, component, ice_username_fragment, ice_password, 187 this, content_name, component, ice_username_fragment, ice_password,
183 stun_hosts(), relay_hosts(), relay_token(), url_context_); 188 stun_hosts(), relay_hosts(), relay_token(), url_context_);
184 } 189 }
185 190
186 } // namespace remoting 191 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698