Remove deprecated SocketFactory overrides.
Bug: webrtc:9198 Change-Id: I0ec3e4120e936fefa76e6cef968d7f615f568aa8 Reviewed-on: https://webrtc-review.googlesource.com/73964 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23156}
This commit is contained in:
parent
31dbc246d7
commit
31e5bf59e0
@ -210,7 +210,7 @@ class RelayPortTest : public testing::Test,
|
||||
private:
|
||||
rtc::AsyncUDPSocket* CreateAsyncUdpSocket(const SocketAddress addr) {
|
||||
rtc::AsyncSocket* socket =
|
||||
virtual_socket_server_->CreateAsyncSocket(SOCK_DGRAM);
|
||||
virtual_socket_server_->CreateAsyncSocket(AF_INET, SOCK_DGRAM);
|
||||
rtc::AsyncUDPSocket* packet_socket =
|
||||
rtc::AsyncUDPSocket::Create(socket, addr);
|
||||
EXPECT_TRUE(packet_socket != NULL);
|
||||
@ -220,7 +220,7 @@ class RelayPortTest : public testing::Test,
|
||||
|
||||
rtc::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
|
||||
rtc::AsyncSocket* socket =
|
||||
virtual_socket_server_->CreateAsyncSocket(SOCK_STREAM);
|
||||
virtual_socket_server_->CreateAsyncSocket(AF_INET, SOCK_STREAM);
|
||||
EXPECT_GE(socket->Bind(addr), 0);
|
||||
EXPECT_GE(socket->Listen(5), 0);
|
||||
return socket;
|
||||
|
||||
@ -87,7 +87,7 @@ class TestTurnServer : public TurnAuthInterface {
|
||||
// For TCP we need to create a server socket which can listen for incoming
|
||||
// new connections.
|
||||
rtc::AsyncSocket* socket =
|
||||
thread_->socketserver()->CreateAsyncSocket(SOCK_STREAM);
|
||||
thread_->socketserver()->CreateAsyncSocket(AF_INET, SOCK_STREAM);
|
||||
if (proto == cricket::PROTO_TLS) {
|
||||
// For TLS, wrap the TCP socket with an SSL adapter. The adapter must
|
||||
// be configured with a self-signed certificate for testing.
|
||||
|
||||
@ -220,7 +220,7 @@ class TurnPortTest : public testing::Test,
|
||||
}
|
||||
|
||||
rtc::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
|
||||
rtc::AsyncSocket* socket = ss_->CreateAsyncSocket(SOCK_STREAM);
|
||||
rtc::AsyncSocket* socket = ss_->CreateAsyncSocket(AF_INET, SOCK_STREAM);
|
||||
EXPECT_GE(socket->Bind(addr), 0);
|
||||
EXPECT_GE(socket->Listen(5), 0);
|
||||
return socket;
|
||||
@ -530,7 +530,7 @@ class TurnPortTest : public testing::Test,
|
||||
// Make a socket and bind it to the local port, to make extra sure no
|
||||
// packet is sent to this address.
|
||||
std::unique_ptr<rtc::Socket> loopback_socket(ss_->CreateSocket(
|
||||
protocol_type == PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM));
|
||||
AF_INET, protocol_type == PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM));
|
||||
ASSERT_NE(nullptr, loopback_socket.get());
|
||||
ASSERT_EQ(0, loopback_socket->Bind(loopback_address));
|
||||
if (protocol_type == PROTO_TCP) {
|
||||
|
||||
@ -196,18 +196,10 @@ bool FirewallSocketServer::IsBindableIp(const rtc::IPAddress& ip) {
|
||||
unbindable_ips_.end();
|
||||
}
|
||||
|
||||
Socket* FirewallSocketServer::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* FirewallSocketServer::CreateSocket(int family, int type) {
|
||||
return WrapSocket(server_->CreateAsyncSocket(family, type), type);
|
||||
}
|
||||
|
||||
AsyncSocket* FirewallSocketServer::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* FirewallSocketServer::CreateAsyncSocket(int family, int type) {
|
||||
return WrapSocket(server_->CreateAsyncSocket(family, type), type);
|
||||
}
|
||||
|
||||
@ -68,10 +68,7 @@ class FirewallSocketServer : public SocketServer {
|
||||
void SetUnbindableIps(const std::vector<rtc::IPAddress>& unbindable_ips);
|
||||
bool IsBindableIp(const rtc::IPAddress& ip);
|
||||
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
void SetMessageQueue(MessageQueue* queue) override;
|
||||
|
||||
@ -359,11 +359,11 @@ class NatTcpTest : public testing::Test, public sigslot::has_slots<> {
|
||||
};
|
||||
|
||||
TEST_F(NatTcpTest, DISABLED_TestConnectOut) {
|
||||
server_.reset(ext_vss_->CreateAsyncSocket(SOCK_STREAM));
|
||||
server_.reset(ext_vss_->CreateAsyncSocket(AF_INET, SOCK_STREAM));
|
||||
server_->Bind(ext_addr_);
|
||||
server_->Listen(5);
|
||||
|
||||
client_.reset(natsf_->CreateAsyncSocket(SOCK_STREAM));
|
||||
client_.reset(natsf_->CreateAsyncSocket(AF_INET, SOCK_STREAM));
|
||||
EXPECT_GE(0, client_->Bind(int_addr_));
|
||||
EXPECT_GE(0, client_->Connect(server_->GetLocalAddress()));
|
||||
|
||||
|
||||
@ -335,18 +335,10 @@ NATSocketFactory::NATSocketFactory(SocketFactory* factory,
|
||||
nat_tcp_addr_(nat_tcp_addr) {
|
||||
}
|
||||
|
||||
Socket* NATSocketFactory::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* NATSocketFactory::CreateSocket(int family, int type) {
|
||||
return new NATSocket(this, family, type);
|
||||
}
|
||||
|
||||
AsyncSocket* NATSocketFactory::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* NATSocketFactory::CreateAsyncSocket(int family, int type) {
|
||||
return new NATSocket(this, family, type);
|
||||
}
|
||||
@ -384,18 +376,10 @@ void NATSocketServer::RemoveTranslator(
|
||||
nats_.Remove(ext_ip);
|
||||
}
|
||||
|
||||
Socket* NATSocketServer::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* NATSocketServer::CreateSocket(int family, int type) {
|
||||
return new NATSocket(this, family, type);
|
||||
}
|
||||
|
||||
AsyncSocket* NATSocketServer::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* NATSocketServer::CreateAsyncSocket(int family, int type) {
|
||||
return new NATSocket(this, family, type);
|
||||
}
|
||||
|
||||
@ -43,9 +43,7 @@ class NATSocketFactory : public SocketFactory, public NATInternalSocketFactory {
|
||||
const SocketAddress& nat_tcp_addr);
|
||||
|
||||
// SocketFactory implementation
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
// NATInternalSocketFactory implementation
|
||||
@ -135,10 +133,7 @@ class NATSocketServer : public SocketServer, public NATInternalSocketFactory {
|
||||
void RemoveTranslator(const SocketAddress& ext_ip);
|
||||
|
||||
// SocketServer implementation
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
void SetMessageQueue(MessageQueue* queue) override;
|
||||
|
||||
@ -25,21 +25,12 @@ void NullSocketServer::WakeUp() {
|
||||
event_.Set();
|
||||
}
|
||||
|
||||
rtc::Socket* NullSocketServer::CreateSocket(int /* type */) {
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rtc::Socket* NullSocketServer::CreateSocket(int /* family */, int /* type */) {
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rtc::AsyncSocket* NullSocketServer::CreateAsyncSocket(int /* type */) {
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rtc::AsyncSocket* NullSocketServer::CreateAsyncSocket(int /* family */,
|
||||
int /* type */) {
|
||||
RTC_NOTREACHED();
|
||||
|
||||
@ -24,9 +24,7 @@ class NullSocketServer : public SocketServer {
|
||||
bool Wait(int cms, bool process_io) override;
|
||||
void WakeUp() override;
|
||||
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -1248,10 +1248,6 @@ void PhysicalSocketServer::WakeUp() {
|
||||
signal_wakeup_->Signal();
|
||||
}
|
||||
|
||||
Socket* PhysicalSocketServer::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* PhysicalSocketServer::CreateSocket(int family, int type) {
|
||||
PhysicalSocket* socket = new PhysicalSocket(this);
|
||||
if (socket->Create(family, type)) {
|
||||
@ -1262,10 +1258,6 @@ Socket* PhysicalSocketServer::CreateSocket(int family, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
AsyncSocket* PhysicalSocketServer::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* PhysicalSocketServer::CreateAsyncSocket(int family, int type) {
|
||||
SocketDispatcher* dispatcher = new SocketDispatcher(this);
|
||||
if (dispatcher->Create(family, type)) {
|
||||
|
||||
@ -67,10 +67,7 @@ class PhysicalSocketServer : public SocketServer {
|
||||
~PhysicalSocketServer() override;
|
||||
|
||||
// SocketFactory:
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
// Internal Factory for Accept (virtual so it can be overwritten in tests).
|
||||
|
||||
@ -59,15 +59,6 @@ class FakePhysicalSocketServer : public PhysicalSocketServer {
|
||||
: test_(test) {
|
||||
}
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override {
|
||||
SocketDispatcher* dispatcher = new FakeSocketDispatcher(this);
|
||||
if (!dispatcher->Create(type)) {
|
||||
delete dispatcher;
|
||||
return nullptr;
|
||||
}
|
||||
return dispatcher;
|
||||
}
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override {
|
||||
SocketDispatcher* dispatcher = new FakeSocketDispatcher(this);
|
||||
if (!dispatcher->Create(family, type)) {
|
||||
|
||||
@ -22,14 +22,9 @@ public:
|
||||
|
||||
// Returns a new socket for blocking communication. The type can be
|
||||
// SOCK_DGRAM and SOCK_STREAM.
|
||||
// TODO: C++ inheritance rules mean that all users must have both
|
||||
// CreateSocket(int) and CreateSocket(int,int). Will remove CreateSocket(int)
|
||||
// (and CreateAsyncSocket(int) when all callers are changed.
|
||||
virtual Socket* CreateSocket(int type) = 0;
|
||||
virtual Socket* CreateSocket(int family, int type) = 0;
|
||||
// Returns a new socket for nonblocking communication. The type can be
|
||||
// SOCK_DGRAM and SOCK_STREAM.
|
||||
virtual AsyncSocket* CreateAsyncSocket(int type) = 0;
|
||||
virtual AsyncSocket* CreateAsyncSocket(int family, int type) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -815,13 +815,13 @@ class VirtualSocketServerTest : public testing::Test {
|
||||
void CrossFamilyDatagramTest(const SocketAddress& client_addr,
|
||||
const SocketAddress& server_addr,
|
||||
bool shouldSucceed) {
|
||||
AsyncSocket* socket = ss_.CreateAsyncSocket(SOCK_DGRAM);
|
||||
AsyncSocket* socket = ss_.CreateAsyncSocket(AF_INET, SOCK_DGRAM);
|
||||
socket->Bind(server_addr);
|
||||
SocketAddress bound_server_addr = socket->GetLocalAddress();
|
||||
auto client1 = MakeUnique<TestClient>(MakeUnique<AsyncUDPSocket>(socket),
|
||||
&fake_clock_);
|
||||
|
||||
AsyncSocket* socket2 = ss_.CreateAsyncSocket(SOCK_DGRAM);
|
||||
AsyncSocket* socket2 = ss_.CreateAsyncSocket(AF_INET, SOCK_DGRAM);
|
||||
socket2->Bind(client_addr);
|
||||
auto client2 = MakeUnique<TestClient>(MakeUnique<AsyncUDPSocket>(socket2),
|
||||
&fake_clock_);
|
||||
|
||||
@ -590,18 +590,10 @@ void VirtualSocketServer::SetSendingBlocked(bool blocked) {
|
||||
}
|
||||
}
|
||||
|
||||
Socket* VirtualSocketServer::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* VirtualSocketServer::CreateSocket(int family, int type) {
|
||||
return CreateSocketInternal(family, type);
|
||||
}
|
||||
|
||||
AsyncSocket* VirtualSocketServer::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* VirtualSocketServer::CreateAsyncSocket(int family, int type) {
|
||||
return CreateSocketInternal(family, type);
|
||||
}
|
||||
|
||||
@ -103,10 +103,7 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> {
|
||||
void SetSendingBlocked(bool blocked);
|
||||
|
||||
// SocketFactory:
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
// SocketServer:
|
||||
|
||||
@ -713,18 +713,10 @@ Win32SocketServer::~Win32SocketServer() {
|
||||
}
|
||||
}
|
||||
|
||||
Socket* Win32SocketServer::CreateSocket(int type) {
|
||||
return CreateSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
Socket* Win32SocketServer::CreateSocket(int family, int type) {
|
||||
return CreateAsyncSocket(family, type);
|
||||
}
|
||||
|
||||
AsyncSocket* Win32SocketServer::CreateAsyncSocket(int type) {
|
||||
return CreateAsyncSocket(AF_INET, type);
|
||||
}
|
||||
|
||||
AsyncSocket* Win32SocketServer::CreateAsyncSocket(int family, int type) {
|
||||
Win32Socket* socket = new Win32Socket;
|
||||
if (socket->CreateT(family, type)) {
|
||||
|
||||
@ -102,10 +102,7 @@ class Win32SocketServer : public SocketServer {
|
||||
}
|
||||
|
||||
// SocketServer Interface
|
||||
Socket* CreateSocket(int type) override;
|
||||
Socket* CreateSocket(int family, int type) override;
|
||||
|
||||
AsyncSocket* CreateAsyncSocket(int type) override;
|
||||
AsyncSocket* CreateAsyncSocket(int family, int type) override;
|
||||
|
||||
void SetMessageQueue(MessageQueue* queue) override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user