Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: webrtc/p2p/client/basicportallocator.cc

Issue 2936553003: Adding PortAllocator option to support cases where sockets can't be bound. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« webrtc/p2p/base/tcpport.cc ('K') | « webrtc/p2p/base/tcpport.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // If the adapter enumeration is disabled, we'll just bind to any address 548 // If the adapter enumeration is disabled, we'll just bind to any address
549 // instead of specific NIC. This is to ensure the same routing for http 549 // instead of specific NIC. This is to ensure the same routing for http
550 // traffic by OS is also used here to avoid any local or public IP leakage 550 // traffic by OS is also used here to avoid any local or public IP leakage
551 // during stun process. 551 // during stun process.
552 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) { 552 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) {
553 network_manager->GetAnyAddressNetworks(&networks); 553 network_manager->GetAnyAddressNetworks(&networks);
554 } else { 554 } else {
555 network_manager->GetNetworks(&networks); 555 network_manager->GetNetworks(&networks);
556 // If network enumeration fails, use the ANY address as a fallback, so we 556 // If network enumeration fails, use the ANY address as a fallback, so we
557 // can at least try gathering candidates using the default route chosen by 557 // can at least try gathering candidates using the default route chosen by
558 // the OS. 558 // the OS. Or, if the PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS flag is
559 if (networks.empty()) { 559 // set, we'll use ANY address candidates either way.
560 if (networks.empty() || flags() & PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS) {
560 network_manager->GetAnyAddressNetworks(&networks); 561 network_manager->GetAnyAddressNetworks(&networks);
561 } 562 }
562 } 563 }
563 networks.erase(std::remove_if(networks.begin(), networks.end(), 564 networks.erase(std::remove_if(networks.begin(), networks.end(),
564 [this](rtc::Network* network) { 565 [this](rtc::Network* network) {
565 return allocator_->network_ignore_mask() & 566 return allocator_->network_ignore_mask() &
566 network->type(); 567 network->type();
567 }), 568 }),
568 networks.end()); 569 networks.end());
569 570
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 ServerAddresses servers; 1528 ServerAddresses servers;
1528 for (size_t i = 0; i < relays.size(); ++i) { 1529 for (size_t i = 0; i < relays.size(); ++i) {
1529 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1530 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1530 servers.insert(relays[i].ports.front().address); 1531 servers.insert(relays[i].ports.front().address);
1531 } 1532 }
1532 } 1533 }
1533 return servers; 1534 return servers;
1534 } 1535 }
1535 1536
1536 } // namespace cricket 1537 } // namespace cricket
OLDNEW
« webrtc/p2p/base/tcpport.cc ('K') | « webrtc/p2p/base/tcpport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698