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

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

Issue 1413423002: Revert of 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, 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 | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/fakeportallocator.h » ('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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if ((filter & CF_REFLEXIVE) && !c.address().IsPrivateIP()) { 548 if ((filter & CF_REFLEXIVE) && !c.address().IsPrivateIP()) {
549 // We allow host candidates if the filter allows server-reflexive 549 // We allow host candidates if the filter allows server-reflexive
550 // candidates and the candidate is a public IP. Because we don't generate 550 // candidates and the candidate is a public IP. Because we don't generate
551 // server-reflexive candidates if they have the same IP as the host 551 // server-reflexive candidates if they have the same IP as the host
552 // candidate (i.e. when the host candidate is a public IP), filtering to 552 // candidate (i.e. when the host candidate is a public IP), filtering to
553 // only server-reflexive candidates won't work right when the host 553 // only server-reflexive candidates won't work right when the host
554 // candidates have public IPs. 554 // candidates have public IPs.
555 return true; 555 return true;
556 } 556 }
557 557
558 // If PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE is specified and it's
559 // loopback address, we should allow it as it's for demo page connectivity
560 // when no TURN/STUN specified.
561 if (c.address().IsLoopbackIP() &&
562 (flags() & PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE) != 0) {
563 return true;
564 }
565
566 // This is just to prevent the case when binding to any address (all 0s), if 558 // This is just to prevent the case when binding to any address (all 0s), if
567 // somehow the host candidate address is not all 0s. Either because local 559 // somehow the host candidate address is not all 0s. Either because local
568 // installed proxy changes the address or a packet has been sent for any 560 // installed proxy changes the address or a packet has been sent for any
569 // reason before getsockname is called. 561 // reason before getsockname is called.
570 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) { 562 if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) {
571 LOG(LS_WARNING) << "Received non-0 host address: " 563 LOG(LS_WARNING) << "Received non-0 host address: "
572 << c.address().ToString() 564 << c.address().ToString()
573 << " when adapter enumeration is disabled"; 565 << " when adapter enumeration is disabled";
574 return false; 566 return false;
575 } 567 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 818
827 void AllocationSequence::CreateUDPPorts() { 819 void AllocationSequence::CreateUDPPorts() {
828 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP)) { 820 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP)) {
829 LOG(LS_VERBOSE) << "AllocationSequence: UDP ports disabled, skipping."; 821 LOG(LS_VERBOSE) << "AllocationSequence: UDP ports disabled, skipping.";
830 return; 822 return;
831 } 823 }
832 824
833 // TODO(mallinath) - Remove UDPPort creating socket after shared socket 825 // TODO(mallinath) - Remove UDPPort creating socket after shared socket
834 // is enabled completely. 826 // is enabled completely.
835 UDPPort* port = NULL; 827 UDPPort* port = NULL;
836 bool emit_localhost_for_anyaddress =
837 IsFlagSet(PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
838 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) { 828 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) {
839 port = UDPPort::Create( 829 port = UDPPort::Create(session_->network_thread(),
840 session_->network_thread(), session_->socket_factory(), network_, 830 session_->socket_factory(), network_,
841 udp_socket_.get(), session_->username(), session_->password(), 831 udp_socket_.get(),
842 session_->allocator()->origin(), emit_localhost_for_anyaddress); 832 session_->username(), session_->password(),
833 session_->allocator()->origin());
843 } else { 834 } else {
844 port = UDPPort::Create( 835 port = UDPPort::Create(session_->network_thread(),
845 session_->network_thread(), session_->socket_factory(), network_, ip_, 836 session_->socket_factory(),
846 session_->allocator()->min_port(), session_->allocator()->max_port(), 837 network_, ip_,
847 session_->username(), session_->password(), 838 session_->allocator()->min_port(),
848 session_->allocator()->origin(), emit_localhost_for_anyaddress); 839 session_->allocator()->max_port(),
840 session_->username(), session_->password(),
841 session_->allocator()->origin());
849 } 842 }
850 843
851 if (port) { 844 if (port) {
852 // If shared socket is enabled, STUN candidate will be allocated by the 845 // If shared socket is enabled, STUN candidate will be allocated by the
853 // UDPPort. 846 // UDPPort.
854 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) { 847 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) {
855 udp_port_ = port; 848 udp_port_ = port;
856 port->SignalDestroyed.connect(this, &AllocationSequence::OnPortDestroyed); 849 port->SignalDestroyed.connect(this, &AllocationSequence::OnPortDestroyed);
857 850
858 // If STUN is not disabled, setting stun server address to port. 851 // If STUN is not disabled, setting stun server address to port.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 ServerAddresses servers; 1127 ServerAddresses servers;
1135 for (size_t i = 0; i < relays.size(); ++i) { 1128 for (size_t i = 0; i < relays.size(); ++i) {
1136 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1129 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1137 servers.insert(relays[i].ports.front().address); 1130 servers.insert(relays[i].ports.front().address);
1138 } 1131 }
1139 } 1132 }
1140 return servers; 1133 return servers;
1141 } 1134 }
1142 1135
1143 } // namespace cricket 1136 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/fakeportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698