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

Unified Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1275703006: Bug 4517: Enable connectivity for demo page when no STUN/TURN specifiefd. (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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 90c2619e92695cd0e37c50623d0646aacb0a149a..70d1945d3d4f2190b46ddf256e0614e0e3e9083d 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -550,6 +550,13 @@ bool BasicPortAllocatorSession::CheckCandidateFilter(const Candidate& c) {
return true;
}
+ // If it's loopback address, we should allow it as it's for demo page
+ // connectivity when no TURN/STUN specified.
+ if (c.address().IsLoopbackIP()) {
+ ASSERT((flags() & PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE) != 0);
+ return true;
+ }
+
// This is just to prevent the case when binding to any address (all 0s), if
// somehow the host candidate address is not all 0s. Either because local
// installed proxy changes the address or a packet has been sent for any
@@ -820,20 +827,20 @@ void AllocationSequence::CreateUDPPorts() {
// TODO(mallinath) - Remove UDPPort creating socket after shared socket
// is enabled completely.
UDPPort* port = NULL;
+ bool emit_localhost_for_anyaddress =
+ IsFlagSet(PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE) &&
+ config_->StunServers().empty() && config_->relays.empty();
pthatcher1 2015/08/07 21:59:49 Can we just check the flag here, and not check the
guoweis_webrtc 2015/08/13 15:08:52 Done.
if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) {
- port = UDPPort::Create(session_->network_thread(),
- session_->socket_factory(), network_,
- udp_socket_.get(),
- session_->username(), session_->password(),
- session_->allocator()->origin());
+ port = UDPPort::Create(
+ session_->network_thread(), session_->socket_factory(), network_,
+ udp_socket_.get(), session_->username(), session_->password(),
+ session_->allocator()->origin(), emit_localhost_for_anyaddress);
} else {
- port = UDPPort::Create(session_->network_thread(),
- session_->socket_factory(),
- network_, ip_,
- session_->allocator()->min_port(),
- session_->allocator()->max_port(),
- session_->username(), session_->password(),
- session_->allocator()->origin());
+ port = UDPPort::Create(
+ session_->network_thread(), session_->socket_factory(), network_, ip_,
+ session_->allocator()->min_port(), session_->allocator()->max_port(),
+ session_->username(), session_->password(),
+ session_->allocator()->origin(), emit_localhost_for_anyaddress);
}
if (port) {

Powered by Google App Engine
This is Rietveld 408576698