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

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

Issue 2599673003: If network enumeration fails, try binding to the "ANY" address. (Closed)
Patch Set: Getting rid of redundant test. Created 4 years 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
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 set_flags(flags() | PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION); 544 set_flags(flags() | PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION);
545 } 545 }
546 // If the adapter enumeration is disabled, we'll just bind to any address 546 // If the adapter enumeration is disabled, we'll just bind to any address
547 // instead of specific NIC. This is to ensure the same routing for http 547 // instead of specific NIC. This is to ensure the same routing for http
548 // traffic by OS is also used here to avoid any local or public IP leakage 548 // traffic by OS is also used here to avoid any local or public IP leakage
549 // during stun process. 549 // during stun process.
550 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) { 550 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) {
551 network_manager->GetAnyAddressNetworks(&networks); 551 network_manager->GetAnyAddressNetworks(&networks);
552 } else { 552 } else {
553 network_manager->GetNetworks(&networks); 553 network_manager->GetNetworks(&networks);
554 // If network enumeration fails, use the ANY address as a fallback, so we
555 // can at least try gathering candidates using the default route chosen by
556 // the OS.
557 if (networks.empty()) {
558 network_manager->GetAnyAddressNetworks(&networks);
559 }
554 } 560 }
555 networks.erase(std::remove_if(networks.begin(), networks.end(), 561 networks.erase(std::remove_if(networks.begin(), networks.end(),
556 [this](rtc::Network* network) { 562 [this](rtc::Network* network) {
557 return allocator_->network_ignore_mask() & 563 return allocator_->network_ignore_mask() &
558 network->type(); 564 network->type();
559 }), 565 }),
560 networks.end()); 566 networks.end());
561 567
562 if (flags() & PORTALLOCATOR_DISABLE_COSTLY_NETWORKS) { 568 if (flags() & PORTALLOCATOR_DISABLE_COSTLY_NETWORKS) {
563 uint16_t lowest_cost = rtc::kNetworkCostMax; 569 uint16_t lowest_cost = rtc::kNetworkCostMax;
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 ServerAddresses servers; 1517 ServerAddresses servers;
1512 for (size_t i = 0; i < relays.size(); ++i) { 1518 for (size_t i = 0; i < relays.size(); ++i) {
1513 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1519 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1514 servers.insert(relays[i].ports.front().address); 1520 servers.insert(relays[i].ports.front().address);
1515 } 1521 }
1516 } 1522 }
1517 return servers; 1523 return servers;
1518 } 1524 }
1519 1525
1520 } // namespace cricket 1526 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698