xrpld
Loading...
Searching...
No Matches
xrpl::ServerImpl< Handler > Class Template Reference

#include <ServerImpl.h>

Inheritance diagram for xrpl::ServerImpl< Handler >:
Collaboration diagram for xrpl::ServerImpl< Handler >:

Public Member Functions

 ServerImpl (Handler &handler, boost::asio::io_context &ioContext, beast::Journal journal)
 ~ServerImpl () override
beast::Journal journal () override
 Returns the Journal associated with the server.
Endpoints ports (std::vector< Port > const &ports) override
 Set the listening port settings.
void close () override
 Close the server.
IOListios ()
boost::asio::io_context & getIoContext ()
bool closed ()

Private Types

using clock_type = std::chrono::system_clock

Static Private Member Functions

static int ceilLog2 (unsigned long long x)

Private Attributes

Handler & handler_
beast::Journal const j_
boost::asio::io_context & ioContext_
boost::asio::strand< boost::asio::io_context::executor_type > strand_
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
std::mutex m_
std::vector< Portports_
std::vector< std::weak_ptr< Door< Handler > > > list_
int high_ = 0
std::array< std::size_t, 64 > hist_ {}
IOList ios_

Static Private Attributes

static constexpr auto kHistorySize = 100

Detailed Description

template<class Handler>
class xrpl::ServerImpl< Handler >

Definition at line 60 of file ServerImpl.h.

Member Typedef Documentation

◆ clock_type

template<class Handler>
using xrpl::ServerImpl< Handler >::clock_type = std::chrono::system_clock
private

Definition at line 63 of file ServerImpl.h.

Constructor & Destructor Documentation

◆ ServerImpl()

template<class Handler>
xrpl::ServerImpl< Handler >::ServerImpl ( Handler & handler,
boost::asio::io_context & ioContext,
beast::Journal journal )

Definition at line 119 of file ServerImpl.h.

◆ ~ServerImpl()

template<class Handler>
xrpl::ServerImpl< Handler >::~ServerImpl ( )
override

Definition at line 132 of file ServerImpl.h.

Member Function Documentation

◆ journal()

template<class Handler>
beast::Journal xrpl::ServerImpl< Handler >::journal ( )
overridevirtual

Returns the Journal associated with the server.

Implements xrpl::Server.

Definition at line 87 of file ServerImpl.h.

◆ ports()

template<class Handler>
Endpoints xrpl::ServerImpl< Handler >::ports ( std::vector< Port > const & v)
overridevirtual

Set the listening port settings.

This may only be called once.

Implements xrpl::Server.

Definition at line 142 of file ServerImpl.h.

◆ close()

template<class Handler>
void xrpl::ServerImpl< Handler >::close ( )
overridevirtual

Close the server.

The close is performed asynchronously. The handler will be notified when the server has stopped. The server is considered stopped when there are no pending I/O completion handlers and all connections have closed. Thread safety: Safe to call concurrently from any thread.

Implements xrpl::Server.

Definition at line 170 of file ServerImpl.h.

◆ ios()

template<class Handler>
IOList & xrpl::ServerImpl< Handler >::ios ( )

Definition at line 99 of file ServerImpl.h.

◆ getIoContext()

template<class Handler>
boost::asio::io_context & xrpl::ServerImpl< Handler >::getIoContext ( )

Definition at line 105 of file ServerImpl.h.

◆ closed()

template<class Handler>
bool xrpl::ServerImpl< Handler >::closed ( )

Definition at line 180 of file ServerImpl.h.

◆ ceilLog2()

template<class Handler>
int xrpl::ServerImpl< Handler >::ceilLog2 ( unsigned long long x)
staticprivate

Member Data Documentation

◆ kHistorySize

template<class Handler>
auto xrpl::ServerImpl< Handler >::kHistorySize = 100
staticconstexprprivate

Definition at line 65 of file ServerImpl.h.

◆ handler_

template<class Handler>
Handler& xrpl::ServerImpl< Handler >::handler_
private

Definition at line 67 of file ServerImpl.h.

◆ j_

template<class Handler>
beast::Journal const xrpl::ServerImpl< Handler >::j_
private

Definition at line 68 of file ServerImpl.h.

◆ ioContext_

template<class Handler>
boost::asio::io_context& xrpl::ServerImpl< Handler >::ioContext_
private

Definition at line 69 of file ServerImpl.h.

◆ strand_

template<class Handler>
boost::asio::strand<boost::asio::io_context::executor_type> xrpl::ServerImpl< Handler >::strand_
private

Definition at line 70 of file ServerImpl.h.

◆ work_

template<class Handler>
std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type> > xrpl::ServerImpl< Handler >::work_
private

Definition at line 71 of file ServerImpl.h.

◆ m_

template<class Handler>
std::mutex xrpl::ServerImpl< Handler >::m_
private

Definition at line 73 of file ServerImpl.h.

◆ ports_

template<class Handler>
std::vector<Port> xrpl::ServerImpl< Handler >::ports_
private

Definition at line 74 of file ServerImpl.h.

◆ list_

template<class Handler>
std::vector<std::weak_ptr<Door<Handler> > > xrpl::ServerImpl< Handler >::list_
private

Definition at line 75 of file ServerImpl.h.

◆ high_

template<class Handler>
int xrpl::ServerImpl< Handler >::high_ = 0
private

Definition at line 76 of file ServerImpl.h.

◆ hist_

template<class Handler>
std::array<std::size_t, 64> xrpl::ServerImpl< Handler >::hist_ {}
private

Definition at line 77 of file ServerImpl.h.

◆ ios_

template<class Handler>
IOList xrpl::ServerImpl< Handler >::ios_
private

Definition at line 79 of file ServerImpl.h.