提交 de3d89fa authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix a crash when there are no more available ports (fixes #222)

- The destructor of ~Transport was being called twice
上级 6c452126
......@@ -163,7 +163,23 @@ namespace RTC
// Ensure there is at least one IP:port binding.
if (this->udpSockets.empty() && this->tcpServers.empty())
{
delete this;
// NOTE: We must manually delete above allocated objects. We cannot call `delete this`
// here since it would call the parent ~Transport destructor, and it would be called
// again after throwing the exception here.
//
// See: https://github.com/versatica/mediasoup/issues/222
this->iceServer->Destroy();
for (auto* socket : this->udpSockets)
{
socket->Destroy();
}
for (auto* server : this->tcpServers)
{
server->Destroy();
}
MS_THROW_ERROR("could not open any IP:port");
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论