henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "p2p/base/portallocator.h" |
Steve Anton | 6c38cc7 | 2017-11-29 10:25:58 -0800 | [diff] [blame] | 12 | |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 13 | #include <iterator> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <set> |
Steve Anton | 6c38cc7 | 2017-11-29 10:25:58 -0800 | [diff] [blame] | 15 | #include <utility> |
| 16 | |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 17 | #include "p2p/base/icecredentialsiterator.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "rtc_base/checks.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include "rtc_base/logging.h" |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 20 | |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 21 | namespace cricket { |
| 22 | |
Steve Anton | 7995d8c | 2017-10-30 16:23:38 -0700 | [diff] [blame] | 23 | RelayServerConfig::RelayServerConfig(RelayType type) : type(type) {} |
| 24 | |
| 25 | RelayServerConfig::RelayServerConfig(const rtc::SocketAddress& address, |
| 26 | const std::string& username, |
| 27 | const std::string& password, |
| 28 | ProtocolType proto) |
| 29 | : type(RELAY_TURN), credentials(username, password) { |
| 30 | ports.push_back(ProtocolAddress(address, proto)); |
| 31 | } |
| 32 | |
| 33 | RelayServerConfig::RelayServerConfig(const std::string& address, |
| 34 | int port, |
| 35 | const std::string& username, |
| 36 | const std::string& password, |
| 37 | ProtocolType proto) |
| 38 | : RelayServerConfig(rtc::SocketAddress(address, port), |
| 39 | username, |
| 40 | password, |
| 41 | proto) {} |
| 42 | |
| 43 | // Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS. |
| 44 | RelayServerConfig::RelayServerConfig(const std::string& address, |
| 45 | int port, |
| 46 | const std::string& username, |
| 47 | const std::string& password, |
| 48 | ProtocolType proto, |
| 49 | bool secure) |
| 50 | : RelayServerConfig(address, |
| 51 | port, |
| 52 | username, |
| 53 | password, |
| 54 | (proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {} |
| 55 | |
| 56 | RelayServerConfig::RelayServerConfig(const RelayServerConfig&) = default; |
| 57 | |
| 58 | RelayServerConfig::~RelayServerConfig() = default; |
| 59 | |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 60 | PortAllocatorSession::PortAllocatorSession(const std::string& content_name, |
| 61 | int component, |
| 62 | const std::string& ice_ufrag, |
| 63 | const std::string& ice_pwd, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 64 | uint32_t flags) |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 65 | : flags_(flags), |
deadbeef | c55fb30 | 2016-05-12 12:51:38 -0700 | [diff] [blame] | 66 | generation_(0), |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 67 | content_name_(content_name), |
| 68 | component_(component), |
deadbeef | cbecd35 | 2015-09-23 11:50:27 -0700 | [diff] [blame] | 69 | ice_ufrag_(ice_ufrag), |
| 70 | ice_pwd_(ice_pwd) { |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 71 | // Pooled sessions are allowed to be created with empty content name, |
| 72 | // component, ufrag and password. |
| 73 | RTC_DCHECK(ice_ufrag.empty() == ice_pwd.empty()); |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Steve Anton | 7995d8c | 2017-10-30 16:23:38 -0700 | [diff] [blame] | 76 | PortAllocatorSession::~PortAllocatorSession() = default; |
| 77 | |
| 78 | bool PortAllocatorSession::IsCleared() const { |
| 79 | return false; |
| 80 | } |
| 81 | |
| 82 | bool PortAllocatorSession::IsStopped() const { |
| 83 | return false; |
| 84 | } |
| 85 | |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 86 | void PortAllocatorSession::GetCandidateStatsFromReadyPorts( |
| 87 | CandidateStatsList* candidate_stats_list) const { |
| 88 | auto ports = ReadyPorts(); |
| 89 | for (auto* port : ports) { |
| 90 | auto candidates = port->Candidates(); |
| 91 | for (const auto& candidate : candidates) { |
| 92 | CandidateStats candidate_stats(candidate); |
| 93 | port->GetStunStats(&candidate_stats.stun_stats); |
Qingsi Wang | 1dac6d8 | 2018-12-12 15:28:47 -0800 | [diff] [blame^] | 94 | bool mdns_obfuscation_enabled = |
| 95 | port->Network()->GetMdnsResponder() != nullptr; |
| 96 | if (mdns_obfuscation_enabled) { |
| 97 | bool use_hostname_address = candidate.type() == LOCAL_PORT_TYPE; |
| 98 | bool filter_related_address = candidate.type() == STUN_PORT_TYPE; |
| 99 | candidate_stats.candidate = candidate_stats.candidate.ToSanitizedCopy( |
| 100 | use_hostname_address, filter_related_address); |
| 101 | } |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 102 | candidate_stats_list->push_back(std::move(candidate_stats)); |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
Steve Anton | 7995d8c | 2017-10-30 16:23:38 -0700 | [diff] [blame] | 107 | uint32_t PortAllocatorSession::generation() { |
| 108 | return generation_; |
| 109 | } |
| 110 | |
| 111 | void PortAllocatorSession::set_generation(uint32_t generation) { |
| 112 | generation_ = generation; |
| 113 | } |
| 114 | |
| 115 | PortAllocator::PortAllocator() |
| 116 | : flags_(kDefaultPortAllocatorFlags), |
| 117 | min_port_(0), |
| 118 | max_port_(0), |
| 119 | max_ipv6_networks_(kDefaultMaxIPv6Networks), |
| 120 | step_delay_(kDefaultStepDelay), |
| 121 | allow_tcp_listen_(true), |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 122 | candidate_filter_(CF_ALL) { |
| 123 | // The allocator will be attached to a thread in Initialize. |
| 124 | thread_checker_.DetachFromThread(); |
| 125 | } |
Steve Anton | 7995d8c | 2017-10-30 16:23:38 -0700 | [diff] [blame] | 126 | |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 127 | void PortAllocator::Initialize() { |
| 128 | RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 129 | initialized_ = true; |
| 130 | } |
| 131 | |
| 132 | PortAllocator::~PortAllocator() { |
| 133 | CheckRunOnValidThreadIfInitialized(); |
| 134 | } |
Steve Anton | 7995d8c | 2017-10-30 16:23:38 -0700 | [diff] [blame] | 135 | |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 136 | void PortAllocator::set_restrict_ice_credentials_change(bool value) { |
| 137 | restrict_ice_credentials_change_ = value; |
| 138 | } |
| 139 | |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 140 | bool PortAllocator::SetConfiguration( |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 141 | const ServerAddresses& stun_servers, |
| 142 | const std::vector<RelayServerConfig>& turn_servers, |
Honghai Zhang | b9e7b4a | 2016-06-30 20:52:02 -0700 | [diff] [blame] | 143 | int candidate_pool_size, |
Jonas Oreland | bdcee28 | 2017-10-10 14:01:40 +0200 | [diff] [blame] | 144 | bool prune_turn_ports, |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 145 | webrtc::TurnCustomizer* turn_customizer, |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 146 | const absl::optional<int>& stun_candidate_keepalive_interval) { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 147 | CheckRunOnValidThreadIfInitialized(); |
Qingsi Wang | e6ded16 | 2018-10-02 16:00:41 -0700 | [diff] [blame] | 148 | // A positive candidate pool size would lead to the creation of a pooled |
| 149 | // allocator session and starting getting ports, which we should only do on |
| 150 | // the network thread. |
| 151 | RTC_DCHECK(candidate_pool_size == 0 || thread_checker_.CalledOnValidThread()); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 152 | bool ice_servers_changed = |
| 153 | (stun_servers != stun_servers_ || turn_servers != turn_servers_); |
| 154 | stun_servers_ = stun_servers; |
| 155 | turn_servers_ = turn_servers; |
Honghai Zhang | b9e7b4a | 2016-06-30 20:52:02 -0700 | [diff] [blame] | 156 | prune_turn_ports_ = prune_turn_ports; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 157 | |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 158 | if (candidate_pool_frozen_) { |
| 159 | if (candidate_pool_size != candidate_pool_size_) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 160 | RTC_LOG(LS_ERROR) |
Jonas Olsson | d7d762d | 2018-03-28 09:47:51 +0200 | [diff] [blame] | 161 | << "Trying to change candidate pool size after pool was frozen."; |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 162 | return false; |
| 163 | } |
| 164 | return true; |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 165 | } |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 166 | |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 167 | if (candidate_pool_size < 0) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 168 | RTC_LOG(LS_ERROR) << "Can't set negative pool size."; |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 169 | return false; |
| 170 | } |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 171 | |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 172 | candidate_pool_size_ = candidate_pool_size; |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 173 | |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 174 | // If ICE servers changed, throw away any existing pooled sessions and create |
| 175 | // new ones. |
| 176 | if (ice_servers_changed) { |
| 177 | pooled_sessions_.clear(); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Jonas Oreland | bdcee28 | 2017-10-10 14:01:40 +0200 | [diff] [blame] | 180 | turn_customizer_ = turn_customizer; |
| 181 | |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 182 | // If |candidate_pool_size_| is less than the number of pooled sessions, get |
| 183 | // rid of the extras. |
| 184 | while (candidate_pool_size_ < static_cast<int>(pooled_sessions_.size())) { |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 185 | pooled_sessions_.back().reset(nullptr); |
| 186 | pooled_sessions_.pop_back(); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 187 | } |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 188 | |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 189 | // |stun_candidate_keepalive_interval_| will be used in STUN port allocation |
| 190 | // in future sessions. We also update the ready ports in the pooled sessions. |
| 191 | // Ports in sessions that are taken and owned by P2PTransportChannel will be |
| 192 | // updated there via IceConfig. |
| 193 | stun_candidate_keepalive_interval_ = stun_candidate_keepalive_interval; |
| 194 | for (const auto& session : pooled_sessions_) { |
| 195 | session->SetStunKeepaliveIntervalForReadyPorts( |
| 196 | stun_candidate_keepalive_interval_); |
| 197 | } |
| 198 | |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 199 | // If |candidate_pool_size_| is greater than the number of pooled sessions, |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 200 | // create new sessions. |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 201 | while (static_cast<int>(pooled_sessions_.size()) < candidate_pool_size_) { |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 202 | IceParameters iceCredentials = |
| 203 | IceCredentialsIterator::CreateRandomIceCredentials(); |
| 204 | PortAllocatorSession* pooled_session = |
| 205 | CreateSessionInternal("", 0, iceCredentials.ufrag, iceCredentials.pwd); |
| 206 | pooled_session->set_pooled(true); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 207 | pooled_session->StartGettingPorts(); |
| 208 | pooled_sessions_.push_back( |
| 209 | std::unique_ptr<PortAllocatorSession>(pooled_session)); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 210 | } |
deadbeef | 6de92f9 | 2016-12-12 18:49:32 -0800 | [diff] [blame] | 211 | return true; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | std::unique_ptr<PortAllocatorSession> PortAllocator::CreateSession( |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 215 | const std::string& content_name, |
| 216 | int component, |
| 217 | const std::string& ice_ufrag, |
| 218 | const std::string& ice_pwd) { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 219 | CheckRunOnValidThreadAndInitialized(); |
Taylor Brandstetter | 417eebe | 2016-05-23 16:02:19 -0700 | [diff] [blame] | 220 | auto session = std::unique_ptr<PortAllocatorSession>( |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 221 | CreateSessionInternal(content_name, component, ice_ufrag, ice_pwd)); |
Taylor Brandstetter | 417eebe | 2016-05-23 16:02:19 -0700 | [diff] [blame] | 222 | session->SetCandidateFilter(candidate_filter()); |
| 223 | return session; |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | std::unique_ptr<PortAllocatorSession> PortAllocator::TakePooledSession( |
| 227 | const std::string& content_name, |
| 228 | int component, |
| 229 | const std::string& ice_ufrag, |
| 230 | const std::string& ice_pwd) { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 231 | CheckRunOnValidThreadAndInitialized(); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 232 | RTC_DCHECK(!ice_ufrag.empty()); |
| 233 | RTC_DCHECK(!ice_pwd.empty()); |
| 234 | if (pooled_sessions_.empty()) { |
| 235 | return nullptr; |
| 236 | } |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 237 | |
| 238 | IceParameters credentials(ice_ufrag, ice_pwd, false); |
| 239 | // If restrict_ice_credentials_change_ is TRUE, then call FindPooledSession |
| 240 | // with ice credentials. Otherwise call it with nullptr which means |
| 241 | // "find any" pooled session. |
| 242 | auto cit = FindPooledSession(restrict_ice_credentials_change_ ? &credentials |
| 243 | : nullptr); |
| 244 | if (cit == pooled_sessions_.end()) { |
| 245 | return nullptr; |
| 246 | } |
| 247 | |
| 248 | auto it = |
| 249 | pooled_sessions_.begin() + std::distance(pooled_sessions_.cbegin(), cit); |
| 250 | std::unique_ptr<PortAllocatorSession> ret = std::move(*it); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 251 | ret->SetIceParameters(content_name, component, ice_ufrag, ice_pwd); |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 252 | ret->set_pooled(false); |
| 253 | // According to JSEP, a pooled session should filter candidates only |
| 254 | // after it's taken out of the pool. |
Taylor Brandstetter | 417eebe | 2016-05-23 16:02:19 -0700 | [diff] [blame] | 255 | ret->SetCandidateFilter(candidate_filter()); |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 256 | pooled_sessions_.erase(it); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 257 | return ret; |
| 258 | } |
| 259 | |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 260 | const PortAllocatorSession* PortAllocator::GetPooledSession( |
| 261 | const IceParameters* ice_credentials) const { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 262 | CheckRunOnValidThreadAndInitialized(); |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 263 | auto it = FindPooledSession(ice_credentials); |
| 264 | if (it == pooled_sessions_.end()) { |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 265 | return nullptr; |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 266 | } else { |
| 267 | return it->get(); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 268 | } |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | std::vector<std::unique_ptr<PortAllocatorSession>>::const_iterator |
| 272 | PortAllocator::FindPooledSession(const IceParameters* ice_credentials) const { |
| 273 | for (auto it = pooled_sessions_.begin(); it != pooled_sessions_.end(); ++it) { |
| 274 | if (ice_credentials == nullptr || |
| 275 | ((*it)->ice_ufrag() == ice_credentials->ufrag && |
| 276 | (*it)->ice_pwd() == ice_credentials->pwd)) { |
| 277 | return it; |
| 278 | } |
| 279 | } |
| 280 | return pooled_sessions_.end(); |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 281 | } |
| 282 | |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 283 | void PortAllocator::FreezeCandidatePool() { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 284 | CheckRunOnValidThreadAndInitialized(); |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 285 | candidate_pool_frozen_ = true; |
| 286 | } |
| 287 | |
| 288 | void PortAllocator::DiscardCandidatePool() { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 289 | CheckRunOnValidThreadIfInitialized(); |
deadbeef | 42a4263 | 2017-03-10 15:18:00 -0800 | [diff] [blame] | 290 | pooled_sessions_.clear(); |
| 291 | } |
| 292 | |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 293 | void PortAllocator::GetCandidateStatsFromPooledSessions( |
| 294 | CandidateStatsList* candidate_stats_list) { |
Qingsi Wang | a2d6067 | 2018-04-11 16:57:45 -0700 | [diff] [blame] | 295 | CheckRunOnValidThreadAndInitialized(); |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 296 | for (const auto& session : pooled_sessions()) { |
| 297 | session->GetCandidateStatsFromReadyPorts(candidate_stats_list); |
| 298 | } |
| 299 | } |
| 300 | |
Jonas Oreland | 1cd39fa | 2018-10-11 07:47:12 +0200 | [diff] [blame] | 301 | std::vector<IceParameters> PortAllocator::GetPooledIceCredentials() { |
| 302 | CheckRunOnValidThreadAndInitialized(); |
| 303 | std::vector<IceParameters> list; |
| 304 | for (const auto& session : pooled_sessions_) { |
| 305 | list.push_back( |
| 306 | IceParameters(session->ice_ufrag(), session->ice_pwd(), false)); |
| 307 | } |
| 308 | return list; |
| 309 | } |
| 310 | |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 311 | } // namespace cricket |