Skip to content
Snippets Groups Projects
Commit 6f27b766 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

peer_connection: fix notify_one() crash

This is a bit a hacky patch. The real fix will be to remove underlyingIce()
But tls must be checked before shutdown to avoid to use a non existing object.
Imho what really happen is that the ice is moved in IceSocketEndpoint::shutdown()
so when  TlsSocketEndpoint::Impl is detroyed, the callback is not reset, tls
become nullptr and then we try to shutdown this non existing tls.
However, removing underlyingIce is not straight forward as every shutdown event
must close all layers of the socket, so at first, just fix this issue.

Change-Id: Ifd9c3733e175787b97a48f3c3e282287963018bb
parent bb396ff0
Branches
Tags
No related merge requests found
......@@ -198,7 +198,11 @@ public:
};
tls = std::make_unique<tls::TlsSession>(std::move(ep), tls_param, tls_cbs);
ep_->underlyingICE()->setOnShutdown([this]() { tls->shutdown(); });
if (const auto& ice = ep_->underlyingICE())
ice->setOnShutdown([this]() {
if (tls)
tls->shutdown();
});
}
Impl(std::unique_ptr<IceSocketEndpoint>&& ep,
......@@ -231,10 +235,11 @@ public:
};
tls = std::make_unique<tls::TlsSession>(std::move(ep), tls_param, tls_cbs);
ep_->underlyingICE()->setOnShutdown([this]() {
if (tls)
tls->shutdown();
});
if (const auto& ice = ep_->underlyingICE())
ice->setOnShutdown([this]() {
if (tls)
tls->shutdown();
});
}
~Impl()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment