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

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

Issue 1274013002: Bug 4865: Enable connectivity when the remote peer is on public internet. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 4 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
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 std::vector<Candidate> candidates; 444 std::vector<Candidate> candidates;
445 ProtocolType pvalue; 445 ProtocolType pvalue;
446 bool candidate_allowed_to_send = CheckCandidateFilter(c); 446 bool candidate_allowed_to_send = CheckCandidateFilter(c);
447 if (StringToProto(c.protocol().c_str(), &pvalue) && 447 if (StringToProto(c.protocol().c_str(), &pvalue) &&
448 data->sequence()->ProtocolEnabled(pvalue) && 448 data->sequence()->ProtocolEnabled(pvalue) &&
449 candidate_allowed_to_send) { 449 candidate_allowed_to_send) {
450 candidates.push_back(c); 450 candidates.push_back(c);
451 } 451 }
452 452
453 if (!candidates.empty()) { 453 if (!candidates.empty()) {
454 SignalCandidatesReady(this, candidates); 454 SignalCandidatesReady(this, candidates);
juberti1 2015/08/06 00:35:26 Will we push 0.0.0.0 to the application here? We w
pthatcher1 2015/08/06 01:06:19 I believe candidate_allowed_to_send will be false
guoweis_webrtc 2015/08/06 08:50:07 Correct. It'll be filtered out
455 } 455 }
456 456
457 // Moving to READY state as we have atleast one candidate from the port. 457 // Moving to READY state as we have at least one candidate from the port or
juberti1 2015/08/06 00:35:26 This comment could be worded better. It's importan
guoweis_webrtc 2015/08/06 08:50:07 Done.
458 // Since this port has atleast one candidate we should forward this port 458 // the candidate has the any address. When this port has at least one
459 // to listners, to allow connections from this port. 459 // candidate we should forward this port to listeners, to allow connections
460 // Also we should make sure that candidate gathered from this port is allowed 460 // from this port. Also we should make sure that candidate gathered from this
461 // to send outside. 461 // port is allowed to send outside. When the candidate address is the any
462 if (!data->ready() && candidate_allowed_to_send) { 462 // address, we need to move the port to READY such that connectivity is
463 // possible if the remote peer has a routable IP address on public Internet.
pthatcher1 2015/08/06 01:06:19 I think we can re-word this in terms of "we're rea
guoweis_webrtc 2015/08/06 08:50:06 Done.
464 if (!data->ready() && (candidate_allowed_to_send ||
465 (c.address().IsAnyIP() && port->SharedSocket()))) {
pthatcher1 2015/08/06 01:06:19 I think this would be a lot more readable if we br
guoweis_webrtc 2015/08/06 08:50:07 I rephrase it a bit. Send and Receive is not very
463 data->set_ready(); 466 data->set_ready();
464 SignalPortReady(this, port); 467 SignalPortReady(this, port);
465 } 468 }
466 } 469 }
467 470
468 void BasicPortAllocatorSession::OnPortComplete(Port* port) { 471 void BasicPortAllocatorSession::OnPortComplete(Port* port) {
469 ASSERT(rtc::Thread::Current() == network_thread_); 472 ASSERT(rtc::Thread::Current() == network_thread_);
470 PortData* data = FindPort(port); 473 PortData* data = FindPort(port);
471 ASSERT(data != NULL); 474 ASSERT(data != NULL);
472 475
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 ServerAddresses servers; 1122 ServerAddresses servers;
1120 for (size_t i = 0; i < relays.size(); ++i) { 1123 for (size_t i = 0; i < relays.size(); ++i) {
1121 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1124 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1122 servers.insert(relays[i].ports.front().address); 1125 servers.insert(relays[i].ports.front().address);
1123 } 1126 }
1124 } 1127 }
1125 return servers; 1128 return servers;
1126 } 1129 }
1127 1130
1128 } // namespace cricket 1131 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698