Delete gturn support

Delete enum RelayType and classes RelayPort and RelayServer.

See also PSA: https://groups.google.com/forum/?#!msg/discuss-webrtc/0ROpUXpw3Gs/eikIN-eEBwAJROpUXpw3Gs/eikIN-eEBwAJ

Bug: webrtc:10998
Change-Id: I1eab760dc73df9156cd1224cf99ad4a4c12ed882
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154522
Reviewed-by: Justin Uberti <juberti@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29677}
This commit is contained in:
Niels Möller
2019-11-04 08:49:12 +01:00
committed by Commit Bot
parent 9dda1b3a48
commit 191e38fb47
19 changed files with 52 additions and 3145 deletions

View File

@ -20,7 +20,6 @@
#include "absl/algorithm/container.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port.h"
#include "p2p/base/relay_port.h"
#include "p2p/base/stun_port.h"
#include "p2p/base/tcp_port.h"
#include "p2p/base/turn_port.h"
@ -1522,42 +1521,7 @@ void AllocationSequence::CreateRelayPorts() {
}
for (RelayServerConfig& relay : config_->relays) {
if (relay.type == RELAY_GTURN) {
CreateGturnPort(relay);
} else if (relay.type == RELAY_TURN) {
CreateTurnPort(relay);
} else {
RTC_NOTREACHED();
}
}
}
void AllocationSequence::CreateGturnPort(const RelayServerConfig& config) {
// TODO(mallinath) - Rename RelayPort to GTurnPort.
std::unique_ptr<RelayPort> port = RelayPort::Create(
session_->network_thread(), session_->socket_factory(), network_,
session_->allocator()->min_port(), session_->allocator()->max_port(),
config_->username, config_->password);
if (port) {
RelayPort* port_ptr = port.release();
// Since RelayPort is not created using shared socket, |port| will not be
// added to the dequeue.
// Note: We must add the allocated port before we add addresses because
// the latter will create candidates that need name and preference
// settings. However, we also can't prepare the address (normally
// done by AddAllocatedPort) until we have these addresses. So we
// wait to do that until below.
session_->AddAllocatedPort(port_ptr, this, false);
// Add the addresses of this protocol.
PortList::const_iterator relay_port;
for (relay_port = config.ports.begin(); relay_port != config.ports.end();
++relay_port) {
port_ptr->AddServerAddress(*relay_port);
port_ptr->AddExternalAddress(*relay_port);
}
// Start fetching an address for this port.
port_ptr->PrepareAddress();
CreateTurnPort(relay);
}
}
@ -1720,7 +1684,7 @@ ServerAddresses PortConfiguration::StunServers() {
// Every UDP TURN server should also be used as a STUN server if
// use_turn_server_as_stun_server is not disabled or the stun servers are
// empty.
ServerAddresses turn_servers = GetRelayServerAddresses(RELAY_TURN, PROTO_UDP);
ServerAddresses turn_servers = GetRelayServerAddresses(PROTO_UDP);
for (const rtc::SocketAddress& turn_server : turn_servers) {
if (stun_servers.find(turn_server) == stun_servers.end()) {
stun_servers.insert(turn_server);
@ -1744,21 +1708,19 @@ bool PortConfiguration::SupportsProtocol(const RelayServerConfig& relay,
return false;
}
bool PortConfiguration::SupportsProtocol(RelayType turn_type,
ProtocolType type) const {
bool PortConfiguration::SupportsProtocol(ProtocolType type) const {
for (size_t i = 0; i < relays.size(); ++i) {
if (relays[i].type == turn_type && SupportsProtocol(relays[i], type))
if (SupportsProtocol(relays[i], type))
return true;
}
return false;
}
ServerAddresses PortConfiguration::GetRelayServerAddresses(
RelayType turn_type,
ProtocolType type) const {
ServerAddresses servers;
for (size_t i = 0; i < relays.size(); ++i) {
if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
if (SupportsProtocol(relays[i], type)) {
servers.insert(relays[i].ports.front().address);
}
}