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

tls_session: cancel requests on destruction

requests_ is passed as a shared_ptr in verifyCertificateWrapper.
If the session is destroyed, the request will not be stopped and
will not return any result. So we need to cancel it.

Change-Id: If631a3c5409aea05136278d4ab7b1e2d0ae7c3cb
parent 35fcdb46
No related branches found
No related tags found
No related merge requests found
......@@ -368,6 +368,14 @@ TlsSession::TlsSessionImpl::~TlsSessionImpl()
state_ = TlsSessionState::SHUTDOWN;
stateCondition_.notify_all();
rxCv_.notify_all();
{
std::lock_guard<std::mutex> lock(requestsMtx_);
// requests_ store a shared_ptr, so we need to cancel requests
// to not be stuck in verifyCertificateWrapper
for (auto& request : requests_)
request->cancel();
requests_.clear();
}
thread_.join();
if (not transport_->isReliable())
transport_->setOnRecv(nullptr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment