3#include <xrpld/app/misc/detail/Work.h>
5#include <xrpl/basics/random.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>
34 using request_type = boost::beast::http::request<boost::beast::http::empty_body>;
40 boost::asio::io_context&
ios_;
41 boost::asio::strand<boost::asio::io_context::executor_type>
strand_;
55 boost::asio::io_context& ios,
66 return *
static_cast<Impl*
>(
this);
107 boost::asio::io_context& ios,
136 if (!
strand_.running_in_this_thread())
138 return boost::asio::post(
140 boost::asio::bind_executor(
147 boost::asio::bind_executor(
151 impl().shared_from_this(),
152 std::placeholders::_1,
153 std::placeholders::_2)));
160 if (!
strand_.running_in_this_thread())
162 return boost::asio::post(
165 boost::asio::bind_executor(
192 boost::asio::async_connect(
195 boost::asio::bind_executor(
199 impl().shared_from_this(),
200 std::placeholders::_1,
201 std::placeholders::_2)));
213 impl().onConnect(ec);
220 req_.method(boost::beast::http::verb::get);
225 req_.prepare_payload();
226 boost::beast::http::async_write(
229 boost::asio::bind_executor(
241 boost::beast::http::async_read(
245 boost::asio::bind_executor(
258 XRPL_ASSERT(
cb_,
"xrpl::detail::WorkBase::onResponse : callback is set");
270 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)