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

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

Issue 1263603003: Remove PORTALLOCATOR_ENABLE_SHARED_SOCKET. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/connectivitychecker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 1965ad94f73188dd57d0b5c6f01397cca5fa3944..8f2c4756bb89a682decf3ac9628d0006a2f813b7 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -121,7 +121,6 @@ class AllocationSequence : public rtc::MessageHandler,
}
void CreateUDPPorts();
void CreateTCPPorts();
- void CreateStunPorts();
void CreateRelayPorts();
void CreateGturnPort(const RelayServerConfig& config);
void CreateTurnPort(const RelayServerConfig& config);
@@ -754,25 +753,15 @@ AllocationSequence::AllocationSequence(BasicPortAllocatorSession* session,
}
bool AllocationSequence::Init() {
- if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) &&
- !IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_UFRAG)) {
- LOG(LS_ERROR) << "Shared socket option can't be set without "
- << "shared ufrag.";
- ASSERT(false);
- return false;
- }
-
- if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) {
- udp_socket_.reset(session_->socket_factory()->CreateUdpSocket(
- rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(),
- session_->allocator()->max_port()));
- if (udp_socket_) {
- udp_socket_->SignalReadPacket.connect(
- this, &AllocationSequence::OnReadPacket);
- }
- // Continuing if |udp_socket_| is NULL, as local TCP and RelayPort using TCP
- // are next available options to setup a communication channel.
+ udp_socket_.reset(session_->socket_factory()->CreateUdpSocket(
+ rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(),
+ session_->allocator()->max_port()));
+ if (udp_socket_) {
+ udp_socket_->SignalReadPacket.connect(
+ this, &AllocationSequence::OnReadPacket);
}
+ // Continuing if |udp_socket_| is NULL, as local TCP and RelayPort using TCP
+ // are next available options to setup a communication channel.
return true;
}
@@ -842,7 +831,6 @@ void AllocationSequence::OnMessage(rtc::Message* msg) {
switch (phase_) {
case PHASE_UDP:
CreateUDPPorts();
- CreateStunPorts();
EnableProtocol(PROTO_UDP);
break;
@@ -902,36 +890,23 @@ void AllocationSequence::CreateUDPPorts() {
// TODO(mallinath) - Remove UDPPort creating socket after shared socket
// is enabled completely.
UDPPort* port = NULL;
- 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());
- } 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_,
+ udp_socket_.get(),
+ session_->username(), session_->password(),
+ session_->allocator()->origin());
if (port) {
// If shared socket is enabled, STUN candidate will be allocated by the
// UDPPort.
- if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) {
- udp_port_ = port;
- port->SignalDestroyed.connect(this, &AllocationSequence::OnPortDestroyed);
-
- // If STUN is not disabled, setting stun server address to port.
- if (!IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) {
- if (config_ && !config_->StunServers().empty()) {
- LOG(LS_INFO) << "AllocationSequence: UDPPort will be handling the "
- << "STUN candidate generation.";
- port->set_server_addresses(config_->StunServers());
- }
+ udp_port_ = port;
+ port->SignalDestroyed.connect(this, &AllocationSequence::OnPortDestroyed);
+
+ // If STUN is not disabled, setting stun server address to port.
+ if (!IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) {
+ if (config_ && !config_->StunServers().empty()) {
+ LOG(LS_INFO) << "AllocationSequence: UDPPort will be handling the "
+ << "STUN candidate generation.";
+ port->set_server_addresses(config_->StunServers());
}
}
@@ -959,37 +934,6 @@ void AllocationSequence::CreateTCPPorts() {
}
}
-void AllocationSequence::CreateStunPorts() {
- if (IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) {
- LOG(LS_VERBOSE) << "AllocationSequence: STUN ports disabled, skipping.";
- return;
- }
-
- if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) {
- return;
- }
-
- if (!(config_ && !config_->StunServers().empty())) {
- LOG(LS_WARNING)
- << "AllocationSequence: No STUN server configured, skipping.";
- return;
- }
-
- StunPort* port = StunPort::Create(session_->network_thread(),
- session_->socket_factory(),
- network_, ip_,
- session_->allocator()->min_port(),
- session_->allocator()->max_port(),
- session_->username(), session_->password(),
- config_->StunServers(),
- session_->allocator()->origin());
- if (port) {
- session_->AddAllocatedPort(port, this, true);
- // Since StunPort is not created using shared socket, |port| will not be
- // added to the dequeue.
- }
-}
-
void AllocationSequence::CreateRelayPorts() {
if (IsFlagSet(PORTALLOCATOR_DISABLE_RELAY)) {
LOG(LS_VERBOSE) << "AllocationSequence: Relay ports disabled, skipping.";
@@ -1058,8 +1002,7 @@ void AllocationSequence::CreateTurnPort(const RelayServerConfig& config) {
// don't pass shared socket for ports which will create TCP sockets.
// TODO(mallinath) - Enable shared socket mode for TURN ports. Disabled
// due to webrtc bug https://code.google.com/p/webrtc/issues/detail?id=3537
- if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) &&
- relay_port->proto == PROTO_UDP) {
+ if (relay_port->proto == PROTO_UDP) {
port = TurnPort::Create(session_->network_thread(),
session_->socket_factory(),
network_, udp_socket_.get(),
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/connectivitychecker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698