From: Casey Bodley Date: Thu, 15 Feb 2024 03:42:56 +0000 (-0500) Subject: rgw/http: async_wait() uses async_initiate X-Git-Tag: v20.0.0~1890^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c21bdb974dadf1496557e7cb21181c5e8c83ec01;p=ceph.git rgw/http: async_wait() uses async_initiate Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index a1873586b013f..50c0f6a775ec7 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -61,15 +61,13 @@ struct rgw_http_req_data : public RefCountedObject { memset(error_buf, 0, sizeof(error_buf)); } - template - auto async_wait(ExecutionContext& ctx, CompletionToken&& token) { - boost::asio::async_completion init(token); - auto& handler = init.completion_handler; - { - std::unique_lock l{lock}; - completion = Completion::create(ctx.get_executor(), std::move(handler)); - } - return init.result.get(); + template + auto async_wait(const Executor& ex, CompletionToken&& token) { + return boost::asio::async_initiate( + [this] (auto handler, auto ex) { + std::unique_lock l{lock}; + completion = Completion::create(ex, std::move(handler)); + }, token, ex); } int wait(optional_yield y) { @@ -77,10 +75,9 @@ struct rgw_http_req_data : public RefCountedObject { return ret; } if (y) { - auto& context = y.get_io_context(); auto& yield = y.get_yield_context(); boost::system::error_code ec; - async_wait(context, yield[ec]); + async_wait(yield.get_executor(), yield[ec]); return -ec.value(); } // work on asio threads should be asynchronous, so warn when they block