| 39 | // of its own until the accept completes). |
| 40 | template <typename Cancellable> |
| 41 | bool run_until(asio::io_context& ctx, |
| 42 | Cancellable& cancellable, |
| 43 | const bool& done, |
| 44 | std::chrono::milliseconds timeout) { |
| 45 | ctx.restart(); |
| 46 | ctx.run_for(timeout); |
| 47 | if (!done) { // deadline hit before the op completed |
| 48 | asio::error_code ignore; |
| 49 | cancellable.cancel(ignore); |
| 50 | ctx.run(); // let the cancelled handler run so its captures are safe to |
| 51 | // destroy |
| 52 | return true; // timed out |
| 53 | } |
| 54 | return false; |
| 55 | } |
| 56 | } // namespace |
| 57 | |
| 58 | AsioTransport::AsioTransport(const std::string& host, |
no test coverage detected