Revert "Add thread checker to PortAllocator and its subclasses and fix a bug"
This reverts commit fc43d11717e16dd427ac84fee614e5511e43cefd.
Reason for revert: Crashes downstream tests
Original change's description:
> Add thread checker to PortAllocator and its subclasses and fix a bug
> causing memory contention by threads.
>
> PortAllocator and its subclasses assume all of their methods except the
> constructor must be called on the same thread (the network thread in
> practice). This CL adds a thread checker to PortAllocator and its
> subclasses for thread safety, and fixes bugs of invoking some of their
> methods in PeerConnection on the signaling thread.
>
> Bug: webrtc:9112
> Change-Id: I33ba9bae72ec09a45ec70435962f3f25cd31583c
> Reviewed-on: https://webrtc-review.googlesource.com/66945
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22814}
TBR=deadbeef@webrtc.org,pthatcher@google.com,pthatcher@webrtc.org,qingsi@google.com,honghaiz@webrtc.org
Change-Id: I2db6561d5d6366d38caa58c3e719d0d48eda70c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9112
Reviewed-on: https://webrtc-review.googlesource.com/69200
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22818}
diff --git a/p2p/client/basicportallocator_unittest.cc b/p2p/client/basicportallocator_unittest.cc
index 6ed13b5..f39e61e 100644
--- a/p2p/client/basicportallocator_unittest.cc
+++ b/p2p/client/basicportallocator_unittest.cc
@@ -166,7 +166,6 @@
allocator_.reset(new BasicPortAllocator(&network_manager_, stun_servers,
kRelayUdpIntAddr, kRelayTcpIntAddr,
kRelaySslTcpIntAddr));
- allocator_->Initialize();
allocator_->set_step_delay(kMinimumStepDelay);
}
@@ -202,7 +201,6 @@
// Endpoint is on the public network. No STUN or TURN.
void ResetWithNoServersOrNat() {
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
allocator_->set_step_delay(kMinimumStepDelay);
}
// Endpoint is behind a NAT, with STUN specified.
@@ -485,8 +483,7 @@
}
allocator_.reset(new BasicPortAllocator(
&network_manager_, nat_socket_factory_.get(), stun_servers));
- allocator_->Initialize();
- allocator_->set_step_delay(kMinimumStepDelay);
+ allocator().set_step_delay(kMinimumStepDelay);
}
std::unique_ptr<rtc::VirtualSocketServer> vss_;
@@ -582,7 +579,6 @@
AddInterface(kClientAddr, "net1");
AddInterface(kClientIPv6Addr, "net1");
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
allocator_->SetConfiguration(allocator_->stun_servers(),
allocator_->turn_servers(), 0, true);
AddTurnServers(kTurnUdpIntIPv6Addr, rtc::SocketAddress());
@@ -620,7 +616,6 @@
turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
AddInterface(kClientAddr);
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
allocator_->SetConfiguration(allocator_->stun_servers(),
allocator_->turn_servers(), 0, true);
AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
@@ -667,7 +662,6 @@
AddInterface(kClientAddr2, "net2", rtc::ADAPTER_TYPE_CELLULAR);
AddInterface(kClientIPv6Addr2, "net2", rtc::ADAPTER_TYPE_CELLULAR);
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
allocator_->SetConfiguration(allocator_->stun_servers(),
allocator_->turn_servers(), 0, true);
// Have both UDP/TCP and IPv4/IPv6 TURN ports.
@@ -1657,7 +1651,6 @@
turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
AddInterface(kClientAddr);
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
@@ -1762,7 +1755,6 @@
PROTO_UDP);
AddInterface(kClientAddr);
allocator_.reset(new BasicPortAllocator(&network_manager_));
- allocator_->Initialize();
RelayServerConfig turn_server(RELAY_TURN);
RelayCredentials credentials(kTurnUsername, kTurnPassword);
turn_server.credentials = credentials;