Skip to content

Commit

Permalink
Undo recent damage to when a Channel is closed :(.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Jul 19, 2024
1 parent c28c69a commit 2f91fb5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib-protocol/source/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,20 @@ task<void> Channel::Open() noexcept {
task<void> 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 <typename Type_, Type_ Pointer_>
Expand Down

0 comments on commit 2f91fb5

Please sign in to comment.