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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 | 297 |
298 allocation_started_ = true; | 298 allocation_started_ = true; |
299 } | 299 } |
300 | 300 |
301 // For each network, see if we have a sequence that covers it already. If not, | 301 // For each network, see if we have a sequence that covers it already. If not, |
302 // create a new sequence to create the appropriate ports. | 302 // create a new sequence to create the appropriate ports. |
303 void BasicPortAllocatorSession::DoAllocate() { | 303 void BasicPortAllocatorSession::DoAllocate() { |
304 bool done_signal_needed = false; | 304 bool done_signal_needed = false; |
305 std::vector<rtc::Network*> networks; | 305 std::vector<rtc::Network*> networks; |
306 | 306 |
307 // SignalNetworksChanged should have been fired when we are here. | |
308 DCHECK(allocator_->network_manager()->network_permission_state() != | |
309 rtc::NetworkManager::STATE_UNKNOWN); | |
310 | |
311 // If the network permission state is BLOCKED, we just act as if the flag has | |
312 // been passed in. | |
313 if (allocator_->network_manager()->network_permission_state() == | |
314 rtc::NetworkManager::STATE_BLOCKED) { | |
pthatcher1
2015/08/18 18:34:20
In a release build, we would grant access if in th
| |
315 set_flags(flags() | PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION); | |
pthatcher1
2015/08/18 18:34:20
So what if the the permission changes? Should we
| |
316 } | |
pthatcher1
2015/08/18 18:47:59
Can you add a unit test for this?
| |
317 | |
307 // If the adapter enumeration is disabled, we'll just bind to any address | 318 // If the adapter enumeration is disabled, we'll just bind to any address |
308 // instead of specific NIC. This is to ensure the same routing for http | 319 // instead of specific NIC. This is to ensure the same routing for http |
309 // traffic by OS is also used here to avoid any local or public IP leakage | 320 // traffic by OS is also used here to avoid any local or public IP leakage |
310 // during stun process. | 321 // during stun process. |
311 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) { | 322 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) { |
312 allocator_->network_manager()->GetAnyAddressNetworks(&networks); | 323 allocator_->network_manager()->GetAnyAddressNetworks(&networks); |
313 } else { | 324 } else { |
314 allocator_->network_manager()->GetNetworks(&networks); | 325 allocator_->network_manager()->GetNetworks(&networks); |
315 } | 326 } |
316 if (networks.empty()) { | 327 if (networks.empty()) { |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 ServerAddresses servers; | 1138 ServerAddresses servers; |
1128 for (size_t i = 0; i < relays.size(); ++i) { | 1139 for (size_t i = 0; i < relays.size(); ++i) { |
1129 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 1140 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |
1130 servers.insert(relays[i].ports.front().address); | 1141 servers.insert(relays[i].ports.front().address); |
1131 } | 1142 } |
1132 } | 1143 } |
1133 return servers; | 1144 return servers; |
1134 } | 1145 } |
1135 | 1146 |
1136 } // namespace cricket | 1147 } // namespace cricket |
OLD | NEW |