| 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 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 Loading... |
| 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 |
| OLD | NEW |