OLD | NEW |
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 Loading... |
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 | 150 if (network_settings.nat_traversal_mode != |
151 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_STUN)) | 151 NetworkSettings::NAT_TRAVERSAL_ENABLED) { |
152 flags |= cricket::PORTALLOCATOR_DISABLE_STUN; | 152 flags |= cricket::PORTALLOCATOR_DISABLE_STUN | |
153 | 153 cricket::PORTALLOCATOR_DISABLE_RELAY; |
154 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_RELAY)) | 154 } |
155 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; | |
156 | |
157 result->set_flags(flags); | 155 result->set_flags(flags); |
158 result->SetPortRange(network_settings.min_port, | 156 result->SetPortRange(network_settings.min_port, |
159 network_settings.max_port); | 157 network_settings.max_port); |
160 | 158 |
161 return result.Pass(); | 159 return result.Pass(); |
162 } | 160 } |
163 | 161 |
164 ChromiumPortAllocator::ChromiumPortAllocator( | 162 ChromiumPortAllocator::ChromiumPortAllocator( |
165 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 163 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
166 scoped_ptr<talk_base::NetworkManager> network_manager, | 164 scoped_ptr<talk_base::NetworkManager> network_manager, |
(...skipping 12 matching lines...) Expand all Loading... |
179 const std::string& content_name, | 177 const std::string& content_name, |
180 int component, | 178 int component, |
181 const std::string& ice_username_fragment, | 179 const std::string& ice_username_fragment, |
182 const std::string& ice_password) { | 180 const std::string& ice_password) { |
183 return new ChromiumPortAllocatorSession( | 181 return new ChromiumPortAllocatorSession( |
184 this, content_name, component, ice_username_fragment, ice_password, | 182 this, content_name, component, ice_username_fragment, ice_password, |
185 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 183 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
186 } | 184 } |
187 | 185 |
188 } // namespace remoting | 186 } // namespace remoting |
OLD | NEW |