mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-11-14 14:40:01 +01:00
Cancellation fixes
Summary: related to T11798 - Cancel functions post outstanding handlers - Properly cancel autoconnect stream Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Differential Revision: https://repo.mireo.local/D27763
This commit is contained in:
@@ -160,10 +160,14 @@ public:
|
||||
_waiting.pop_front();
|
||||
if (!op) continue;
|
||||
op.get_cancellation_slot().clear();
|
||||
auto ex = asio::get_associated_executor(op, _ex);
|
||||
asio::require(ex, asio::execution::blocking.possibly)
|
||||
.execute([op = std::move(op)]() mutable {
|
||||
std::move(op)(asio::error::operation_aborted);
|
||||
asio::require(_ex, asio::execution::blocking.never)
|
||||
.execute([ex = _ex, op = std::move(op)]() mutable {
|
||||
auto opex = asio::get_associated_executor(op, ex);
|
||||
opex.execute(
|
||||
[op = std::move(op)]() mutable {
|
||||
op(asio::error::operation_aborted);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -178,7 +182,9 @@ private:
|
||||
.execute([ex = _ex, op = std::move(op)]() mutable {
|
||||
auto opex = asio::get_associated_executor(op, ex);
|
||||
opex.execute(
|
||||
[op = std::move(op)]() mutable { op(error_code{}); }
|
||||
[op = std::move(op)]() mutable {
|
||||
op(error_code {});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user