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