3#include <xrpl/basics/chrono.h>
4#include <xrpl/beast/core/List.h>
5#include <xrpl/server/detail/Door.h>
6#include <xrpl/server/detail/io_list.h>
8#include <boost/asio.hpp>
9#include <boost/asio/executor_work_guard.hpp>
10#include <boost/asio/io_context.hpp>
59template <
class Handler>
70 boost::asio::strand<boost::asio::io_context::executor_type>
strand_;
104 boost::asio::io_context&
118template <
class Handler>
121 boost::asio::io_context& ioContext,
131template <
class Handler>
135 work_ = std::nullopt;
140template <
class Handler>
149 for (
auto const& port :
ports)
152 auto& internalPort =
ports_.back();
157 auto ep = sp->getEndpoint();
158 if (internalPort.port == 0u)
159 internalPort.port = ep.port();
160 eps.
emplace(port.name, std::move(ep));
168template <
class Handler>
173 work_ = std::nullopt;
178template <
class Handler>
182 return ios_.closed();
A generic endpoint for log messages.
Manages a set of objects performing asynchronous I/O.
std::vector< Port > ports_
ServerImpl(Handler &handler, boost::asio::io_context &ioContext, beast::Journal journal)
boost::asio::io_context & getIoContext()
Endpoints ports(std::vector< Port > const &ports) override
Set the listening port settings.
void close() override
Close the server.
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
boost::asio::strand< boost::asio::io_context::executor_type > strand_
std::chrono::system_clock clock_type
boost::asio::io_context & ioContext_
static constexpr auto kHistorySize
std::array< std::size_t, 64 > hist_
std::vector< std::weak_ptr< Door< Handler > > > list_
static int ceilLog2(unsigned long long x)
beast::Journal journal() override
Returns the Journal associated with the server.
virtual void close()=0
Close the server.
virtual ~Server()=default
Destroy the server.
virtual beast::Journal journal()=0
Returns the Journal associated with the server.
virtual Endpoints ports(std::vector< Port > const &v)=0
Set the listening port settings.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unordered_map< std::string, boost::asio::ip::tcp::endpoint > Endpoints
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)