Delete wiring of SignalAddressReady for TCP ports
This feature is used only by chromium, and only for UDP sockets.
Bug: webrtc:13065
Change-Id: I207ea643aa57cf23bdd36266895f65f1ee251aaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35106}
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index 9c4bc0f..48607d1 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -1503,22 +1503,6 @@
EXPECT_EQ(1U, port->Candidates().size());
}
-TEST_F(PortTest, TestDelayedBindingTcp) {
- FakeAsyncPacketSocket* socket = new FakeAsyncPacketSocket();
- FakePacketSocketFactory socket_factory;
-
- socket_factory.set_next_server_tcp_socket(socket);
- auto port = CreateTcpPort(kLocalAddr1, &socket_factory);
-
- socket->set_state(AsyncPacketSocket::STATE_BINDING);
- port->PrepareAddress();
-
- EXPECT_EQ(0U, port->Candidates().size());
- socket->SignalAddressReady(socket, kLocalAddr2);
-
- EXPECT_EQ(1U, port->Candidates().size());
-}
-
TEST_F(PortTest, TestDisableInterfaceOfTcpPort) {
FakeAsyncPacketSocket* lsocket = new FakeAsyncPacketSocket();
FakeAsyncPacketSocket* rsocket = new FakeAsyncPacketSocket();
@@ -1530,10 +1514,10 @@
socket_factory.set_next_server_tcp_socket(rsocket);
auto rport = CreateTcpPort(kLocalAddr2, &socket_factory);
- lsocket->set_state(AsyncPacketSocket::STATE_BINDING);
- lsocket->SignalAddressReady(lsocket, kLocalAddr1);
- rsocket->set_state(AsyncPacketSocket::STATE_BINDING);
- rsocket->SignalAddressReady(rsocket, kLocalAddr2);
+ lsocket->set_state(AsyncPacketSocket::STATE_BOUND);
+ lsocket->local_address_ = kLocalAddr1;
+ rsocket->set_state(AsyncPacketSocket::STATE_BOUND);
+ rsocket->local_address_ = kLocalAddr2;
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
lport->SetIceTiebreaker(kTiebreaker1);
@@ -1576,12 +1560,14 @@
if (type == SOCK_DGRAM) {
factory.set_next_udp_socket(socket);
ports[i] = CreateUdpPort(addresses[i], &factory);
+ socket->set_state(AsyncPacketSocket::STATE_BINDING);
+ socket->SignalAddressReady(socket, addresses[i]);
} else if (type == SOCK_STREAM) {
factory.set_next_server_tcp_socket(socket);
ports[i] = CreateTcpPort(addresses[i], &factory);
+ socket->set_state(AsyncPacketSocket::STATE_BOUND);
+ socket->local_address_ = addresses[i];
}
- socket->set_state(AsyncPacketSocket::STATE_BINDING);
- socket->SignalAddressReady(socket, addresses[i]);
ports[i]->PrepareAddress();
}
diff --git a/p2p/base/tcp_port.cc b/p2p/base/tcp_port.cc
index 4c5c38e..d6b8e3a 100644
--- a/p2p/base/tcp_port.cc
+++ b/p2p/base/tcp_port.cc
@@ -166,8 +166,7 @@
void TCPPort::PrepareAddress() {
if (socket_) {
- // If socket isn't bound yet the address will be added in
- // OnAddressReady(). Socket may be in the CLOSED state if Listen()
+ // Socket may be in the CLOSED state if Listen()
// failed, we still want to add the socket address.
RTC_LOG(LS_VERBOSE) << "Preparing TCP address, current state: "
<< socket_->GetState();
@@ -300,7 +299,6 @@
return;
}
socket_->SignalNewConnection.connect(this, &TCPPort::OnNewConnection);
- socket_->SignalAddressReady.connect(this, &TCPPort::OnAddressReady);
}
rtc::AsyncPacketSocket* TCPPort::GetIncoming(const rtc::SocketAddress& addr,
@@ -335,13 +333,6 @@
Port::OnReadyToSend();
}
-void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket,
- const rtc::SocketAddress& address) {
- AddAddress(address, address, rtc::SocketAddress(), TCP_PROTOCOL_NAME, "",
- TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP,
- 0, "", true);
-}
-
// TODO(qingsi): `CONNECTION_WRITE_CONNECT_TIMEOUT` is overriden by
// `ice_unwritable_timeout` in IceConfig when determining the writability state.
// Replace this constant with the config parameter assuming the default value if
diff --git a/p2p/base/tcp_port.h b/p2p/base/tcp_port.h
index 36257b0..6e7d00f 100644
--- a/p2p/base/tcp_port.h
+++ b/p2p/base/tcp_port.h
@@ -102,9 +102,6 @@
void OnReadyToSend(rtc::AsyncPacketSocket* socket);
- void OnAddressReady(rtc::AsyncPacketSocket* socket,
- const rtc::SocketAddress& address);
-
bool allow_listen_;
rtc::AsyncPacketSocket* socket_;
int error_;
diff --git a/rtc_base/async_packet_socket.h b/rtc_base/async_packet_socket.h
index d47d57b..89797aa 100644
--- a/rtc_base/async_packet_socket.h
+++ b/rtc_base/async_packet_socket.h
@@ -117,8 +117,7 @@
// Emitted after address for the socket is allocated, i.e. binding
// is finished. State of the socket is changed from BINDING to BOUND
- // (for UDP and server TCP sockets) or CONNECTING (for client TCP
- // sockets).
+ // (for UDP sockets).
sigslot::signal2<AsyncPacketSocket*, const SocketAddress&> SignalAddressReady;
// Emitted for client TCP sockets when state is changed from