Skip to content
Snippets Groups Projects
Commit f0f834df authored by Adrien Béraud's avatar Adrien Béraud
Browse files

multiplexed socket: avoid use-after-free

Change-Id: I0c093ea4e1834866fd08abb30d51d5043fe1f455
parent d16f8162
Branches
No related tags found
No related merge requests found
......@@ -226,11 +226,15 @@ public:
void
MultiplexedSocket::Impl::eventLoop()
{
endpoint->setOnStateChange([this](tls::TlsSessionState state) {
if (state == tls::TlsSessionState::SHUTDOWN && !isShutdown_) {
if (logger_)
logger_->debug("Tls endpoint is down, shutdown multiplexed socket");
shutdown();
endpoint->setOnStateChange([w = parent_.weak_from_this()](tls::TlsSessionState state) {
auto ssock = w.lock();
if (!ssock)
return false;
auto& this_ = *ssock->pimpl_;
if (state == tls::TlsSessionState::SHUTDOWN && !this_.isShutdown_) {
if (this_.logger_)
this_.logger_->debug("Tls endpoint is down, shutdown multiplexed socket");
this_.shutdown();
return false;
}
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment