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

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

Issue 3015543002: Try creating sockets again if network change occurs after bind failed. (Closed)
Patch Set: Split up TestGatherLowCostNetworkOnly Created 3 years, 2 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
« no previous file with comments | « p2p/base/relayport.cc ('k') | 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 return; 1098 return;
1099 } 1099 }
1100 1100
1101 if (!((network == network_) && (previous_best_ip_ == network->GetBestIP()))) { 1101 if (!((network == network_) && (previous_best_ip_ == network->GetBestIP()))) {
1102 // Different network setup; nothing is equivalent. 1102 // Different network setup; nothing is equivalent.
1103 return; 1103 return;
1104 } 1104 }
1105 1105
1106 // Else turn off the stuff that we've already got covered. 1106 // Else turn off the stuff that we've already got covered.
1107 1107
1108 // Every config implicitly specifies local, so turn that off right away. 1108 // Every config implicitly specifies local, so turn that off right away if we
1109 *flags |= PORTALLOCATOR_DISABLE_UDP; 1109 // already have a port of the corresponding type. Look for a port that
1110 *flags |= PORTALLOCATOR_DISABLE_TCP; 1110 // matches this AllocationSequence's network, is the right protocol, and
1111 // hasn't encountered an error.
1112 // TODO(deadbeef): This doesn't take into account that there may be another
1113 // AllocationSequence that's ABOUT to allocate a UDP port, but hasn't yet.
1114 // This can happen if, say, there's a network change event right before an
1115 // application-triggered ICE restart. Hopefully this problem will just go
1116 // away if we get rid of the gathering "phases" though, which is planned.
1117 if (std::any_of(session_->ports_.begin(), session_->ports_.end(),
1118 [this](const BasicPortAllocatorSession::PortData& p) {
1119 return p.port()->Network() == network_ &&
1120 p.port()->GetProtocol() == PROTO_UDP && !p.error();
1121 })) {
1122 *flags |= PORTALLOCATOR_DISABLE_UDP;
1123 }
1124 if (std::any_of(session_->ports_.begin(), session_->ports_.end(),
1125 [this](const BasicPortAllocatorSession::PortData& p) {
1126 return p.port()->Network() == network_ &&
1127 p.port()->GetProtocol() == PROTO_TCP && !p.error();
1128 })) {
1129 *flags |= PORTALLOCATOR_DISABLE_TCP;
1130 }
1111 1131
1112 if (config_ && config) { 1132 if (config_ && config) {
1113 if (config_->StunServers() == config->StunServers()) { 1133 if (config_->StunServers() == config->StunServers()) {
1114 // Already got this STUN servers covered. 1134 // Already got this STUN servers covered.
1115 *flags |= PORTALLOCATOR_DISABLE_STUN; 1135 *flags |= PORTALLOCATOR_DISABLE_STUN;
1116 } 1136 }
1117 if (!config_->relays.empty()) { 1137 if (!config_->relays.empty()) {
1118 // Already got relays covered. 1138 // Already got relays covered.
1119 // NOTE: This will even skip a _different_ set of relay servers if we 1139 // NOTE: This will even skip a _different_ set of relay servers if we
1120 // were to be given one, but that never happens in our codebase. Should 1140 // were to be given one, but that never happens in our codebase. Should
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 ServerAddresses servers; 1524 ServerAddresses servers;
1505 for (size_t i = 0; i < relays.size(); ++i) { 1525 for (size_t i = 0; i < relays.size(); ++i) {
1506 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1526 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1507 servers.insert(relays[i].ports.front().address); 1527 servers.insert(relays[i].ports.front().address);
1508 } 1528 }
1509 } 1529 }
1510 return servers; 1530 return servers;
1511 } 1531 }
1512 1532
1513 } // namespace cricket 1533 } // namespace cricket
OLDNEW
« no previous file with comments | « p2p/base/relayport.cc ('k') | p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698