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:
Korina Šimičević
2024-02-06 13:40:05 +01:00
parent 0de02e3c53
commit e0ae572e1b
9 changed files with 48 additions and 57 deletions

View File

@@ -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 {});
}
);
});
}