Unverified 提交 644e2a44 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

worker: Add Transport::Destroying() protected method (#1114)

上级 99403005
# Changelog
### Next
* `Worker`: Add `Transport::Destroying()` protected method ([PR #1114](https://github.com/versatica/mediasoup/pull/1114)).
### 3.12.5
* `DataConsumer`: Fix removed 'bufferedamountlow' notification ([PR #1113](https://github.com/versatica/mediasoup/pull/1113)).
......
......@@ -144,6 +144,7 @@ namespace RTC
protected:
// Must be called from the subclass.
void Destroying();
void Connected();
void Disconnected();
void DataReceived(size_t len)
......
......@@ -28,6 +28,10 @@ namespace RTC
{
MS_TRACE();
// Tell the Transport parent class that we are about to destroy
// the class instance.
Destroying();
this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
}
......
......@@ -117,6 +117,10 @@ namespace RTC
{
MS_TRACE();
// Tell the Transport parent class that we are about to destroy
// the class instance.
Destroying();
this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
delete this->udpSocket;
......
......@@ -206,6 +206,10 @@ namespace RTC
{
MS_TRACE();
// Tell the Transport parent class that we are about to destroy
// the class instance.
Destroying();
this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
delete this->udpSocket;
......
......@@ -182,9 +182,6 @@ namespace RTC
{
MS_TRACE();
// Set the destroying flag.
this->destroying = true;
// The destructor must delete and clear everything silently.
// Delete all Producers.
......@@ -1594,6 +1591,13 @@ namespace RTC
}
}
void Transport::Destroying()
{
MS_TRACE();
this->destroying = true;
}
void Transport::Connected()
{
MS_TRACE();
......
......@@ -300,6 +300,11 @@ namespace RTC
{
MS_TRACE();
// We need to tell the Transport parent class that we are about to destroy
// the class instance. This is because child's destructor runs before
// parent's destructor. See comment in Transport::OnSctpAssociationSendData().
Destroying();
this->shared->channelMessageRegistrator->UnregisterHandler(this->id);
// Must delete the DTLS transport first since it will generate a DTLS alert
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论