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/detail/Door.h>
26#include <xrpl/server/detail/io_list.h>
28#include <boost/asio.hpp>
78template <
class Handler>
103 boost::asio::io_service& io_service,
126 boost::asio::io_service&
140template <
class Handler>
143 boost::asio::io_service& io_service,
147 , io_service_(io_service)
148 , strand_(io_service_)
153template <
class Handler>
162template <
class Handler>
167 Throw<std::logic_error>(
"ports() on closed Server");
168 ports_.reserve(ports.
size());
171 for (
auto const& port : ports)
173 ports_.push_back(port);
174 auto& internalPort = ports_.back();
176 handler_, io_service_, internalPort, j_))
180 auto ep = sp->get_endpoint();
181 if (!internalPort.port)
182 internalPort.port = ep.port();
183 eps.
emplace(port.name, std::move(ep));
191template <
class Handler>
197 handler_.onStopped(*
this);
201template <
class Handler>
205 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.