3#include <xrpld/app/misc/detail/Work.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/protocol/BuildInfo.h>
8#include <boost/asio.hpp>
9#include <boost/asio/strand.hpp>
10#include <boost/beast/core/multi_buffer.hpp>
11#include <boost/beast/http/empty_body.hpp>
12#include <boost/beast/http/read.hpp>
13#include <boost/beast/http/write.hpp>
37 using request_type = boost::beast::http::request<boost::beast::http::empty_body>;
43 boost::asio::io_context&
ios_;
44 boost::asio::strand<boost::asio::io_context::executor_type>
strand_;
58 boost::asio::io_context& ios,
69 return *
static_cast<Impl*
>(
this);
110 boost::asio::io_context& ios,
139 if (!
strand_.running_in_this_thread())
141 return boost::asio::post(
142 ios_, boost::asio::bind_executor(
strand_, [self =
impl().shared_from_this()] {
150 boost::asio::bind_executor(
153 self->onResolve(ec, results);
161 if (!
strand_.running_in_this_thread())
163 return boost::asio::post(
166 boost::asio::bind_executor(
167 strand_, [self =
impl().shared_from_this()] { self->cancel(); }));
193 boost::asio::async_connect(
196 boost::asio::bind_executor(
198 [self =
impl().shared_from_this()](
202 self->WorkBase::onConnect(ec, endpoint);
215 impl().onConnect(ec);
222 req_.method(boost::beast::http::verb::get);
227 req_.prepare_payload();
228 boost::beast::http::async_write(
231 boost::asio::bind_executor(
244 boost::beast::http::async_read(
248 boost::asio::bind_executor(
250 self->onResponse(ec);
262 XRPL_ASSERT(
cb_,
"xrpl::detail::WorkBase::onResponse : callback is set");
274 socket_.shutdown(boost::asio::socket_base::shutdown_send, ec);
void fail(error_code const &ec)
endpoint_type lastEndpoint_
std::function< void(error_code const &, endpoint_type const &, response_type &&)> callback_type
boost::beast::http::request< boost::beast::http::empty_body > request_type
void onResolve(error_code const &ec, results_type results)
boost::asio::ip::tcp::endpoint endpoint_type
boost::system::error_code error_code
boost::asio::ip::tcp::resolver::results_type results_type
void onRequest(error_code const &ec)
boost::asio::ip::tcp::socket socket_type
void onConnect(error_code const &ec, endpoint_type const &endpoint)
boost::asio::strand< boost::asio::io_context::executor_type > strand_
void onResponse(error_code const &ec)
boost::beast::multi_buffer readBuf_
boost::asio::io_context & ios_
boost::asio::ip::tcp::resolver resolver_type
WorkBase(std::string host, std::string path, std::string port, boost::asio::io_context &ios, endpoint_type lastEndpoint, bool lastStatus, callback_type cb)
std::string const & getFullVersionString()
Full server version string.
boost::beast::http::response< boost::beast::http::string_body > response_type
std::error_code make_error_code(xrpl::TokenCodecErrc e)