From 2f91fb5c99124ed459fd41c0db77ae2bfa583735 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 19 Jul 2024 04:16:41 +0000 Subject: [PATCH] Undo recent damage to when a Channel is closed :(. --- lib-protocol/source/channel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib-protocol/source/channel.cpp b/lib-protocol/source/channel.cpp index 82926821e..8f9813093 100644 --- a/lib-protocol/source/channel.cpp +++ b/lib-protocol/source/channel.cpp @@ -131,19 +131,20 @@ task Channel::Open() noexcept { task Channel::Shut() noexcept { co_await Post([&]() { channel_->Close(); - channel_->UnregisterObserver(); - const auto state(channel_->state()); if (Verbose) Log() << "closed channel in state " << webrtc::DataChannelInterface::DataStateString(state) << std::endl; if (state != webrtc::DataChannelInterface::kClosed) Stop(); + }); + + co_await Pump::Shut(); + co_await Post([&]() { + channel_->UnregisterObserver(); channel_ = nullptr; peer_ = nullptr; }); - - co_await Pump::Shut(); } template