| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host/host_port_allocator.h" | 5 #include "remoting/host/host_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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 HostPortAllocatorSession::HostPortAllocatorSession( | 52 HostPortAllocatorSession::HostPortAllocatorSession( |
| 53 cricket::HttpPortAllocatorBase* allocator, | 53 cricket::HttpPortAllocatorBase* allocator, |
| 54 const std::string& content_name, | 54 const std::string& content_name, |
| 55 int component, | 55 int component, |
| 56 const std::string& ice_username_fragment, | 56 const std::string& ice_username_fragment, |
| 57 const std::string& ice_password, | 57 const std::string& ice_password, |
| 58 const std::vector<talk_base::SocketAddress>& stun_hosts, | 58 const std::vector<talk_base::SocketAddress>& stun_hosts, |
| 59 const std::vector<std::string>& relay_hosts, | 59 const std::vector<std::string>& relay_hosts, |
| 60 const std::string& relay, | 60 const std::string& relay, |
| 61 const scoped_refptr<net::URLRequestContextGetter>& url_context) | 61 const scoped_refptr<net::URLRequestContextGetter>& url_context) |
| 62 : HttpPortAllocatorSessionBase( | 62 : HttpPortAllocatorSessionBase(allocator, |
| 63 allocator, content_name, component, ice_username_fragment, ice_password, | 63 content_name, |
| 64 stun_hosts, relay_hosts, relay, ""), | 64 component, |
| 65 url_context_(url_context) { | 65 ice_username_fragment, |
| 66 } | 66 ice_password, |
| 67 stun_hosts, |
| 68 relay_hosts, |
| 69 relay, |
| 70 std::string()), |
| 71 url_context_(url_context) {} |
| 67 | 72 |
| 68 HostPortAllocatorSession::~HostPortAllocatorSession() { | 73 HostPortAllocatorSession::~HostPortAllocatorSession() { |
| 69 STLDeleteElements(&url_fetchers_); | 74 STLDeleteElements(&url_fetchers_); |
| 70 } | 75 } |
| 71 | 76 |
| 72 void HostPortAllocatorSession::ConfigReady(cricket::PortConfiguration* config) { | 77 void HostPortAllocatorSession::ConfigReady(cricket::PortConfiguration* config) { |
| 73 // Filter out non-UDP relay ports, so that we don't try using TCP. | 78 // Filter out non-UDP relay ports, so that we don't try using TCP. |
| 74 for (cricket::PortConfiguration::RelayList::iterator relay = | 79 for (cricket::PortConfiguration::RelayList::iterator relay = |
| 75 config->relays.begin(); relay != config->relays.end(); ++relay) { | 80 config->relays.begin(); relay != config->relays.end(); ++relay) { |
| 76 cricket::PortList filtered_ports; | 81 cricket::PortList filtered_ports; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 result->SetPortRange(network_settings.min_port, | 155 result->SetPortRange(network_settings.min_port, |
| 151 network_settings.max_port); | 156 network_settings.max_port); |
| 152 | 157 |
| 153 return result.Pass(); | 158 return result.Pass(); |
| 154 } | 159 } |
| 155 | 160 |
| 156 HostPortAllocator::HostPortAllocator( | 161 HostPortAllocator::HostPortAllocator( |
| 157 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 162 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 158 scoped_ptr<talk_base::NetworkManager> network_manager, | 163 scoped_ptr<talk_base::NetworkManager> network_manager, |
| 159 scoped_ptr<talk_base::PacketSocketFactory> socket_factory) | 164 scoped_ptr<talk_base::PacketSocketFactory> socket_factory) |
| 160 : HttpPortAllocatorBase(network_manager.get(), socket_factory.get(), ""), | 165 : HttpPortAllocatorBase(network_manager.get(), |
| 166 socket_factory.get(), |
| 167 std::string()), |
| 161 url_context_(url_context), | 168 url_context_(url_context), |
| 162 network_manager_(network_manager.Pass()), | 169 network_manager_(network_manager.Pass()), |
| 163 socket_factory_(socket_factory.Pass()) { | 170 socket_factory_(socket_factory.Pass()) {} |
| 164 } | |
| 165 | 171 |
| 166 HostPortAllocator::~HostPortAllocator() { | 172 HostPortAllocator::~HostPortAllocator() { |
| 167 } | 173 } |
| 168 | 174 |
| 169 cricket::PortAllocatorSession* HostPortAllocator::CreateSessionInternal( | 175 cricket::PortAllocatorSession* HostPortAllocator::CreateSessionInternal( |
| 170 const std::string& content_name, | 176 const std::string& content_name, |
| 171 int component, | 177 int component, |
| 172 const std::string& ice_username_fragment, | 178 const std::string& ice_username_fragment, |
| 173 const std::string& ice_password) { | 179 const std::string& ice_password) { |
| 174 return new HostPortAllocatorSession( | 180 return new HostPortAllocatorSession( |
| 175 this, content_name, component, ice_username_fragment, ice_password, | 181 this, content_name, component, ice_username_fragment, ice_password, |
| 176 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 182 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
| 177 } | 183 } |
| 178 | 184 |
| 179 } // namespace remoting | 185 } // namespace remoting |
| OLD | NEW |