OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/protocol/chromium_port_allocator.h" | 5 #include "remoting/protocol/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 scoped_ptr<rtc::NetworkManager> network_manager( | 136 scoped_ptr<rtc::NetworkManager> network_manager( |
137 new rtc::BasicNetworkManager()); | 137 new rtc::BasicNetworkManager()); |
138 scoped_ptr<rtc::PacketSocketFactory> socket_factory( | 138 scoped_ptr<rtc::PacketSocketFactory> socket_factory( |
139 new ChromiumPacketSocketFactory()); | 139 new ChromiumPacketSocketFactory()); |
140 scoped_ptr<ChromiumPortAllocator> result( | 140 scoped_ptr<ChromiumPortAllocator> result( |
141 new ChromiumPortAllocator(url_context, network_manager.Pass(), | 141 new ChromiumPortAllocator(url_context, network_manager.Pass(), |
142 socket_factory.Pass())); | 142 socket_factory.Pass())); |
143 | 143 |
144 // We always use PseudoTcp to provide a reliable channel. It provides poor | 144 // We always use PseudoTcp to provide a reliable channel. It provides poor |
145 // performance when combined with TCP-based transport, so we have to disable | 145 // performance when combined with TCP-based transport, so we have to disable |
146 // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username | 146 // TCP ports. |
147 // fragment is shared between all candidates for this channel. | |
148 int flags = cricket::PORTALLOCATOR_DISABLE_TCP | | 147 int flags = cricket::PORTALLOCATOR_DISABLE_TCP | |
149 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | | |
150 cricket::PORTALLOCATOR_ENABLE_IPV6; | 148 cricket::PORTALLOCATOR_ENABLE_IPV6; |
151 | 149 |
152 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_STUN)) | 150 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_STUN)) |
153 flags |= cricket::PORTALLOCATOR_DISABLE_STUN; | 151 flags |= cricket::PORTALLOCATOR_DISABLE_STUN; |
154 | 152 |
155 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_RELAY)) | 153 if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_RELAY)) |
156 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; | 154 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; |
157 | 155 |
158 result->set_flags(flags); | 156 result->set_flags(flags); |
159 result->SetPortRange(network_settings.port_range.min_port, | 157 result->SetPortRange(network_settings.port_range.min_port, |
(...skipping 21 matching lines...) Expand all Loading... |
181 int component, | 179 int component, |
182 const std::string& ice_username_fragment, | 180 const std::string& ice_username_fragment, |
183 const std::string& ice_password) { | 181 const std::string& ice_password) { |
184 return new ChromiumPortAllocatorSession( | 182 return new ChromiumPortAllocatorSession( |
185 this, content_name, component, ice_username_fragment, ice_password, | 183 this, content_name, component, ice_username_fragment, ice_password, |
186 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 184 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
187 } | 185 } |
188 | 186 |
189 } // namespace protocol | 187 } // namespace protocol |
190 } // namespace remoting | 188 } // namespace remoting |
OLD | NEW |