| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 [this, &port](const Candidate& candidate) { | 231 [this, &port](const Candidate& candidate) { |
| 232 return CandidatePairable(candidate, port.port()); | 232 return CandidatePairable(candidate, port.port()); |
| 233 })) { | 233 })) { |
| 234 port.set_has_pairable_candidate(false); | 234 port.set_has_pairable_candidate(false); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void BasicPortAllocatorSession::StartGettingPorts() { | 239 void BasicPortAllocatorSession::StartGettingPorts() { |
| 240 network_thread_ = rtc::Thread::Current(); | 240 network_thread_ = rtc::Thread::Current(); |
| 241 PortAllocatorSession::StartGettingPorts(); | 241 state_ = SessionState::GATHERING; |
| 242 if (!socket_factory_) { | 242 if (!socket_factory_) { |
| 243 owned_socket_factory_.reset( | 243 owned_socket_factory_.reset( |
| 244 new rtc::BasicPacketSocketFactory(network_thread_)); | 244 new rtc::BasicPacketSocketFactory(network_thread_)); |
| 245 socket_factory_ = owned_socket_factory_.get(); | 245 socket_factory_ = owned_socket_factory_.get(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 network_thread_->Post(RTC_FROM_HERE, this, MSG_CONFIG_START); | 248 network_thread_->Post(RTC_FROM_HERE, this, MSG_CONFIG_START); |
| 249 | 249 |
| 250 LOG(LS_INFO) << "Pruning turn ports " | 250 LOG(LS_INFO) << "Pruning turn ports " |
| 251 << (prune_turn_ports_ ? "enabled" : "disabled"); | 251 << (prune_turn_ports_ ? "enabled" : "disabled"); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void BasicPortAllocatorSession::StopGettingPorts() { | 254 void BasicPortAllocatorSession::StopGettingPorts() { |
| 255 ASSERT(rtc::Thread::Current() == network_thread_); | 255 ASSERT(rtc::Thread::Current() == network_thread_); |
| 256 network_thread_->Post(RTC_FROM_HERE, this, MSG_CONFIG_STOP); | 256 network_thread_->Post(RTC_FROM_HERE, this, MSG_CONFIG_STOP); |
| 257 ClearGettingPorts(); | 257 ClearGettingPorts(); |
| 258 // Note: this must be called after ClearGettingPorts because both may set the | 258 // Note: this must be called after ClearGettingPorts because both may set the |
| 259 // session state and we should set the state to STOPPED. | 259 // session state and we should set the state to STOPPED. |
| 260 PortAllocatorSession::StopGettingPorts(); | 260 state_ = SessionState::STOPPED; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void BasicPortAllocatorSession::ClearGettingPorts() { | 263 void BasicPortAllocatorSession::ClearGettingPorts() { |
| 264 ASSERT(rtc::Thread::Current() == network_thread_); | 264 ASSERT(rtc::Thread::Current() == network_thread_); |
| 265 network_thread_->Clear(this, MSG_ALLOCATE); | 265 network_thread_->Clear(this, MSG_ALLOCATE); |
| 266 for (uint32_t i = 0; i < sequences_.size(); ++i) { | 266 for (uint32_t i = 0; i < sequences_.size(); ++i) { |
| 267 sequences_[i]->Stop(); | 267 sequences_[i]->Stop(); |
| 268 } | 268 } |
| 269 PortAllocatorSession::ClearGettingPorts(); | 269 state_ = SessionState::CLEARED; |
| 270 } | 270 } |
| 271 | 271 |
| 272 std::vector<rtc::Network*> BasicPortAllocatorSession::GetFailedNetworks() { | 272 std::vector<rtc::Network*> BasicPortAllocatorSession::GetFailedNetworks() { |
| 273 std::vector<rtc::Network*> networks = GetNetworks(); | 273 std::vector<rtc::Network*> networks = GetNetworks(); |
| 274 | 274 |
| 275 // A network interface may have both IPv4 and IPv6 networks. Only if | 275 // A network interface may have both IPv4 and IPv6 networks. Only if |
| 276 // neither of the networks has any connections, the network interface | 276 // neither of the networks has any connections, the network interface |
| 277 // is considered failed and need to be regathered on. | 277 // is considered failed and need to be regathered on. |
| 278 std::set<std::string> networks_with_connection; | 278 std::set<std::string> networks_with_connection; |
| 279 for (const PortData& data : ports_) { | 279 for (const PortData& data : ports_) { |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 ServerAddresses servers; | 1418 ServerAddresses servers; |
| 1419 for (size_t i = 0; i < relays.size(); ++i) { | 1419 for (size_t i = 0; i < relays.size(); ++i) { |
| 1420 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 1420 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |
| 1421 servers.insert(relays[i].ports.front().address); | 1421 servers.insert(relays[i].ports.front().address); |
| 1422 } | 1422 } |
| 1423 } | 1423 } |
| 1424 return servers; | 1424 return servers; |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 } // namespace cricket | 1427 } // namespace cricket |
| OLD | NEW |