PortAllocator is now deleted on network thread

pull/8/head
Ken 2020-10-14 16:48:25 -04:00
parent 2fbe900c8c
commit f83b47801d
1 changed files with 9 additions and 4 deletions

View File

@ -55,7 +55,13 @@ VirtualLink::VirtualLink(
} }
VirtualLink::~VirtualLink() VirtualLink::~VirtualLink()
{} {
// port_allocator_ lives on the network thread and should be destroyed there.
network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
RTC_DCHECK_RUN_ON(network_thread_);
port_allocator_.reset();
});
}
string VirtualLink::Name() string VirtualLink::Name()
{ {
@ -86,8 +92,8 @@ VirtualLink::Initialize(
RegisterLinkEventHandlers(); RegisterLinkEventHandlers();
// The port allocator lives on the network thread and should be initialized there. // The port allocator lives on the network thread and should be initialized there.
const auto pa_result = network_thread_->Invoke<bool>( network_thread_->Invoke<bool>(
RTC_FROM_HERE, rtc::Bind(&VirtualLink::InitializePortAllocator, this)); RTC_FROM_HERE, rtc::Bind(&VirtualLink::InitializePortAllocator, this));
return; return;
} }
@ -274,7 +280,6 @@ VirtualLink::SetupICE(
unique_ptr<SSLIdentity> sslid, unique_ptr<SSLIdentity> sslid,
unique_ptr<SSLFingerprint> local_fingerprint) unique_ptr<SSLFingerprint> local_fingerprint)
{ {
SSLFingerprint const* local_fprnt = nullptr;
if (vlink_desc_->dtls_enabled) if (vlink_desc_->dtls_enabled)
{ {
transport_ctlr_->SetLocalCertificate(RTCCertificate::Create(move(sslid))); transport_ctlr_->SetLocalCertificate(RTCCertificate::Create(move(sslid)));