Do not unlock the connection mutex if the operation was cancelled

Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D27877
This commit is contained in:
Korina Šimičević
2024-02-12 15:19:55 +01:00
parent eaac06fa6a
commit 10aabbb483

View File

@ -67,7 +67,11 @@ public:
}
void operator()(on_locked, typename Owner::stream_ptr s, error_code ec) {
if (ec == asio::error::operation_aborted || !_owner.is_open())
if (ec == asio::error::operation_aborted)
// cancelled without acquiring the lock (by calling client.cancel())
return std::move(_handler)(ec);
if (!_owner.is_open())
return complete(asio::error::operation_aborted);
if (s != _owner._stream_ptr)
@ -182,8 +186,7 @@ private:
void complete(error_code ec) {
get_cancellation_slot().clear();
if (ec != asio::error::operation_aborted)
_owner._conn_mtx.unlock();
_owner._conn_mtx.unlock();
std::move(_handler)(ec);
}