From f83b47801de7c3b3e9c076626c1c2e4c41f9a570 Mon Sep 17 00:00:00 2001 From: Ken Date: Wed, 14 Oct 2020 16:48:25 -0400 Subject: [PATCH] PortAllocator is now deleted on network thread --- tincan/trunk/src/virtual_link.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tincan/trunk/src/virtual_link.cc b/tincan/trunk/src/virtual_link.cc index 1385630..ed3a5a2 100644 --- a/tincan/trunk/src/virtual_link.cc +++ b/tincan/trunk/src/virtual_link.cc @@ -55,7 +55,13 @@ VirtualLink::VirtualLink( } VirtualLink::~VirtualLink() -{} +{ + // port_allocator_ lives on the network thread and should be destroyed there. + network_thread_->Invoke(RTC_FROM_HERE, [this] { + RTC_DCHECK_RUN_ON(network_thread_); + port_allocator_.reset(); + }); +} string VirtualLink::Name() { @@ -86,8 +92,8 @@ VirtualLink::Initialize( RegisterLinkEventHandlers(); // The port allocator lives on the network thread and should be initialized there. - const auto pa_result = network_thread_->Invoke( - RTC_FROM_HERE, rtc::Bind(&VirtualLink::InitializePortAllocator, this)); + network_thread_->Invoke( + RTC_FROM_HERE, rtc::Bind(&VirtualLink::InitializePortAllocator, this)); return; } @@ -274,7 +280,6 @@ VirtualLink::SetupICE( unique_ptr sslid, unique_ptr local_fingerprint) { - SSLFingerprint const* local_fprnt = nullptr; if (vlink_desc_->dtls_enabled) { transport_ctlr_->SetLocalCertificate(RTCCertificate::Create(move(sslid)));