20#ifndef RIPPLE_SERVER_SERVERIMPL_H_INCLUDED
21#define RIPPLE_SERVER_SERVERIMPL_H_INCLUDED
23#include <xrpl/basics/chrono.h>
24#include <xrpl/beast/core/List.h>
25#include <xrpl/server/Server.h>
26#include <xrpl/server/detail/Door.h>
27#include <xrpl/server/detail/io_list.h>
28#include <boost/asio.hpp>
75template <
class Handler>
100 boost::asio::io_service& io_service,
123 boost::asio::io_service&
137template <
class Handler>
140 boost::asio::io_service& io_service,
144 , io_service_(io_service)
145 , strand_(io_service_)
150template <
class Handler>
154 work_ = std::nullopt;
159template <
class Handler>
164 Throw<std::logic_error>(
"ports() on closed Server");
165 ports_.reserve(ports.
size());
168 for (
auto const& port : ports)
170 ports_.push_back(port);
172 handler_, io_service_, ports_.back(), j_))
182template <
class Handler>
187 work_ = std::nullopt;
188 handler_.onStopped(*
this);
192template <
class Handler>
196 return ios_.closed();
A generic endpoint for log messages.
std::vector< std::weak_ptr< Door< Handler > > > list_
boost::asio::io_service::strand strand_
std::vector< Port > ports_
void close() override
Close the server.
std::array< std::size_t, 64 > hist_
std::optional< boost::asio::io_service::work > work_
beast::Journal journal() override
Returns the Journal associated with the server.
boost::asio::io_service & io_service_
boost::asio::io_service & get_io_service()
static int ceil_log2(unsigned long long x)
ServerImpl(Handler &handler, boost::asio::io_service &io_service, beast::Journal journal)
Endpoints ports(std::vector< Port > const &ports) override
Set the listening port settings.
virtual void close()=0
Close the server.
virtual Endpoints ports(std::vector< Port > const &v)=0
Set the listening port settings.
virtual ~Server()=default
Destroy the server.
virtual beast::Journal journal()=0
Returns the Journal associated with the server.
Manages a set of objects performing asynchronous I/O.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.