mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00
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}
This commit is contained in:
parent
2f4098830c
commit
4a1c2c4754
4 changed files with 10 additions and 37 deletions
|
@ -1503,22 +1503,6 @@ TEST_F(PortTest, TestDelayedBindingUdp) {
|
||||||
EXPECT_EQ(1U, port->Candidates().size());
|
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) {
|
TEST_F(PortTest, TestDisableInterfaceOfTcpPort) {
|
||||||
FakeAsyncPacketSocket* lsocket = new FakeAsyncPacketSocket();
|
FakeAsyncPacketSocket* lsocket = new FakeAsyncPacketSocket();
|
||||||
FakeAsyncPacketSocket* rsocket = new FakeAsyncPacketSocket();
|
FakeAsyncPacketSocket* rsocket = new FakeAsyncPacketSocket();
|
||||||
|
@ -1530,10 +1514,10 @@ TEST_F(PortTest, TestDisableInterfaceOfTcpPort) {
|
||||||
socket_factory.set_next_server_tcp_socket(rsocket);
|
socket_factory.set_next_server_tcp_socket(rsocket);
|
||||||
auto rport = CreateTcpPort(kLocalAddr2, &socket_factory);
|
auto rport = CreateTcpPort(kLocalAddr2, &socket_factory);
|
||||||
|
|
||||||
lsocket->set_state(AsyncPacketSocket::STATE_BINDING);
|
lsocket->set_state(AsyncPacketSocket::STATE_BOUND);
|
||||||
lsocket->SignalAddressReady(lsocket, kLocalAddr1);
|
lsocket->local_address_ = kLocalAddr1;
|
||||||
rsocket->set_state(AsyncPacketSocket::STATE_BINDING);
|
rsocket->set_state(AsyncPacketSocket::STATE_BOUND);
|
||||||
rsocket->SignalAddressReady(rsocket, kLocalAddr2);
|
rsocket->local_address_ = kLocalAddr2;
|
||||||
|
|
||||||
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
|
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
|
||||||
lport->SetIceTiebreaker(kTiebreaker1);
|
lport->SetIceTiebreaker(kTiebreaker1);
|
||||||
|
@ -1576,12 +1560,14 @@ void PortTest::TestCrossFamilyPorts(int type) {
|
||||||
if (type == SOCK_DGRAM) {
|
if (type == SOCK_DGRAM) {
|
||||||
factory.set_next_udp_socket(socket);
|
factory.set_next_udp_socket(socket);
|
||||||
ports[i] = CreateUdpPort(addresses[i], &factory);
|
ports[i] = CreateUdpPort(addresses[i], &factory);
|
||||||
|
socket->set_state(AsyncPacketSocket::STATE_BINDING);
|
||||||
|
socket->SignalAddressReady(socket, addresses[i]);
|
||||||
} else if (type == SOCK_STREAM) {
|
} else if (type == SOCK_STREAM) {
|
||||||
factory.set_next_server_tcp_socket(socket);
|
factory.set_next_server_tcp_socket(socket);
|
||||||
ports[i] = CreateTcpPort(addresses[i], &factory);
|
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();
|
ports[i]->PrepareAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,7 @@ Connection* TCPPort::CreateConnection(const Candidate& address,
|
||||||
|
|
||||||
void TCPPort::PrepareAddress() {
|
void TCPPort::PrepareAddress() {
|
||||||
if (socket_) {
|
if (socket_) {
|
||||||
// If socket isn't bound yet the address will be added in
|
// Socket may be in the CLOSED state if Listen()
|
||||||
// OnAddressReady(). Socket may be in the CLOSED state if Listen()
|
|
||||||
// failed, we still want to add the socket address.
|
// failed, we still want to add the socket address.
|
||||||
RTC_LOG(LS_VERBOSE) << "Preparing TCP address, current state: "
|
RTC_LOG(LS_VERBOSE) << "Preparing TCP address, current state: "
|
||||||
<< socket_->GetState();
|
<< socket_->GetState();
|
||||||
|
@ -300,7 +299,6 @@ void TCPPort::TryCreateServerSocket() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket_->SignalNewConnection.connect(this, &TCPPort::OnNewConnection);
|
socket_->SignalNewConnection.connect(this, &TCPPort::OnNewConnection);
|
||||||
socket_->SignalAddressReady.connect(this, &TCPPort::OnAddressReady);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::AsyncPacketSocket* TCPPort::GetIncoming(const rtc::SocketAddress& addr,
|
rtc::AsyncPacketSocket* TCPPort::GetIncoming(const rtc::SocketAddress& addr,
|
||||||
|
@ -335,13 +333,6 @@ void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
|
||||||
Port::OnReadyToSend();
|
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
|
// TODO(qingsi): `CONNECTION_WRITE_CONNECT_TIMEOUT` is overriden by
|
||||||
// `ice_unwritable_timeout` in IceConfig when determining the writability state.
|
// `ice_unwritable_timeout` in IceConfig when determining the writability state.
|
||||||
// Replace this constant with the config parameter assuming the default value if
|
// Replace this constant with the config parameter assuming the default value if
|
||||||
|
|
|
@ -102,9 +102,6 @@ class TCPPort : public Port {
|
||||||
|
|
||||||
void OnReadyToSend(rtc::AsyncPacketSocket* socket);
|
void OnReadyToSend(rtc::AsyncPacketSocket* socket);
|
||||||
|
|
||||||
void OnAddressReady(rtc::AsyncPacketSocket* socket,
|
|
||||||
const rtc::SocketAddress& address);
|
|
||||||
|
|
||||||
bool allow_listen_;
|
bool allow_listen_;
|
||||||
rtc::AsyncPacketSocket* socket_;
|
rtc::AsyncPacketSocket* socket_;
|
||||||
int error_;
|
int error_;
|
||||||
|
|
|
@ -117,8 +117,7 @@ class RTC_EXPORT AsyncPacketSocket : public sigslot::has_slots<> {
|
||||||
|
|
||||||
// Emitted after address for the socket is allocated, i.e. binding
|
// Emitted after address for the socket is allocated, i.e. binding
|
||||||
// is finished. State of the socket is changed from BINDING to BOUND
|
// is finished. State of the socket is changed from BINDING to BOUND
|
||||||
// (for UDP and server TCP sockets) or CONNECTING (for client TCP
|
// (for UDP sockets).
|
||||||
// sockets).
|
|
||||||
sigslot::signal2<AsyncPacketSocket*, const SocketAddress&> SignalAddressReady;
|
sigslot::signal2<AsyncPacketSocket*, const SocketAddress&> SignalAddressReady;
|
||||||
|
|
||||||
// Emitted for client TCP sockets when state is changed from
|
// Emitted for client TCP sockets when state is changed from
|
||||||
|
|
Loading…
Reference in a new issue