rippled
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ripple::Door< Handler > Class Template Reference

A listening socket. More...

#include <Door.h>

Inheritance diagram for ripple::Door< Handler >:
Inheritance graph
[legend]
Collaboration diagram for ripple::Door< Handler >:
Collaboration graph
[legend]

Classes

class  Detector
 
struct  FDStats
 

Public Member Functions

 Door (Handler &handler, boost::asio::io_context &io_context, Port const &port, beast::Journal j)
 
void run ()
 
void close () override
 Close the Door listening socket and connections.
 
endpoint_type get_endpoint () const
 
io_listios ()
 Return the io_list associated with the work.
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 

Private Types

using clock_type = std::chrono::steady_clock
 
using timer_type = boost::asio::basic_waitable_timer< clock_type >
 
using error_code = boost::system::error_code
 
using yield_context = boost::asio::yield_context
 
using protocol_type = boost::asio::ip::tcp
 
using acceptor_type = protocol_type::acceptor
 
using endpoint_type = protocol_type::endpoint
 
using socket_type = boost::asio::ip::tcp::socket
 
using stream_type = boost::beast::tcp_stream
 

Private Member Functions

void reOpen ()
 
std::optional< FDStatsquery_fd_stats () const
 
bool should_throttle_for_fds ()
 
template<class ConstBufferSequence >
void create (bool ssl, ConstBufferSequence const &buffers, stream_type &&stream, endpoint_type remote_address)
 
void do_accept (yield_context yield)
 
template<class = void>
void destroy ()
 

Private Attributes

beast::Journal const j_
 
Port const & port_
 
Handler & handler_
 
boost::asio::io_context & ioc_
 
acceptor_type acceptor_
 
boost::asio::strand< boost::asio::io_context::executor_type > strand_
 
bool ssl_
 
bool plain_
 
std::chrono::milliseconds accept_delay_ {INITIAL_ACCEPT_DELAY}
 
boost::asio::steady_timer backoff_timer_
 
io_listios_ = nullptr
 

Static Private Attributes

static constexpr std::chrono::milliseconds INITIAL_ACCEPT_DELAY {50}
 
static constexpr std::chrono::milliseconds MAX_ACCEPT_DELAY {2000}
 
static constexpr double FREE_FD_THRESHOLD = 0.70
 

Detailed Description

template<class Handler>
class ripple::Door< Handler >

A listening socket.

Definition at line 61 of file Door.h.

Member Typedef Documentation

◆ clock_type

template<class Handler >
using ripple::Door< Handler >::clock_type = std::chrono::steady_clock
private

Definition at line 65 of file Door.h.

◆ timer_type

template<class Handler >
using ripple::Door< Handler >::timer_type = boost::asio::basic_waitable_timer<clock_type>
private

Definition at line 66 of file Door.h.

◆ error_code

template<class Handler >
using ripple::Door< Handler >::error_code = boost::system::error_code
private

Definition at line 67 of file Door.h.

◆ yield_context

template<class Handler >
using ripple::Door< Handler >::yield_context = boost::asio::yield_context
private

Definition at line 68 of file Door.h.

◆ protocol_type

template<class Handler >
using ripple::Door< Handler >::protocol_type = boost::asio::ip::tcp
private

Definition at line 69 of file Door.h.

◆ acceptor_type

template<class Handler >
using ripple::Door< Handler >::acceptor_type = protocol_type::acceptor
private

Definition at line 70 of file Door.h.

◆ endpoint_type

template<class Handler >
using ripple::Door< Handler >::endpoint_type = protocol_type::endpoint
private

Definition at line 71 of file Door.h.

◆ socket_type

template<class Handler >
using ripple::Door< Handler >::socket_type = boost::asio::ip::tcp::socket
private

Definition at line 72 of file Door.h.

◆ stream_type

template<class Handler >
using ripple::Door< Handler >::stream_type = boost::beast::tcp_stream
private

Definition at line 73 of file Door.h.

Constructor & Destructor Documentation

◆ Door()

template<class Handler >
ripple::Door< Handler >::Door ( Handler &  handler,
boost::asio::io_context &  io_context,
Port const &  port,
beast::Journal  j 
)

Definition at line 315 of file Door.h.

Member Function Documentation

◆ reOpen()

template<class Handler >
void ripple::Door< Handler >::reOpen ( )
private

Definition at line 259 of file Door.h.

◆ query_fd_stats()

template<class Handler >
std::optional< typename Door< Handler >::FDStats > ripple::Door< Handler >::query_fd_stats ( ) const
private

Definition at line 470 of file Door.h.

◆ should_throttle_for_fds()

template<class Handler >
bool ripple::Door< Handler >::should_throttle_for_fds ( )
private

Definition at line 501 of file Door.h.

◆ run()

template<class Handler >
void ripple::Door< Handler >::run ( )

Definition at line 340 of file Door.h.

◆ close()

template<class Handler >
void ripple::Door< Handler >::close ( )
overridevirtual

Close the Door listening socket and connections.

The listening socket is closed, and all open connections belonging to the Door are closed. Thread Safety: May be called concurrently

Implements ripple::io_list::work.

Definition at line 352 of file Door.h.

◆ get_endpoint()

template<class Handler >
endpoint_type ripple::Door< Handler >::get_endpoint ( ) const

Definition at line 157 of file Door.h.

◆ create()

template<class Handler >
template<class ConstBufferSequence >
void ripple::Door< Handler >::create ( bool  ssl,
ConstBufferSequence const &  buffers,
stream_type &&  stream,
endpoint_type  remote_address 
)
private

Definition at line 368 of file Door.h.

◆ do_accept()

template<class Handler >
void ripple::Door< Handler >::do_accept ( yield_context  yield)
private

Definition at line 400 of file Door.h.

◆ destroy()

template<class = void>
void ripple::io_list::work::destroy ( )
privateinherited

Definition at line 182 of file io_list.h.

◆ ios()

io_list & ripple::io_list::work::ios ( )
inherited

Return the io_list associated with the work.

Requirements: The call to io_list::emplace to create the work has already returned.

Definition at line 60 of file io_list.h.

Member Data Documentation

◆ j_

template<class Handler >
beast::Journal const ripple::Door< Handler >::j_
private

Definition at line 107 of file Door.h.

◆ port_

template<class Handler >
Port const& ripple::Door< Handler >::port_
private

Definition at line 108 of file Door.h.

◆ handler_

template<class Handler >
Handler& ripple::Door< Handler >::handler_
private

Definition at line 109 of file Door.h.

◆ ioc_

template<class Handler >
boost::asio::io_context& ripple::Door< Handler >::ioc_
private

Definition at line 110 of file Door.h.

◆ acceptor_

template<class Handler >
acceptor_type ripple::Door< Handler >::acceptor_
private

Definition at line 111 of file Door.h.

◆ strand_

template<class Handler >
boost::asio::strand<boost::asio::io_context::executor_type> ripple::Door< Handler >::strand_
private

Definition at line 112 of file Door.h.

◆ ssl_

template<class Handler >
bool ripple::Door< Handler >::ssl_
private

Definition at line 113 of file Door.h.

◆ plain_

template<class Handler >
bool ripple::Door< Handler >::plain_
private

Definition at line 114 of file Door.h.

◆ INITIAL_ACCEPT_DELAY

template<class Handler >
constexpr std::chrono::milliseconds ripple::Door< Handler >::INITIAL_ACCEPT_DELAY {50}
staticconstexprprivate

Definition at line 115 of file Door.h.

◆ MAX_ACCEPT_DELAY

template<class Handler >
constexpr std::chrono::milliseconds ripple::Door< Handler >::MAX_ACCEPT_DELAY {2000}
staticconstexprprivate

Definition at line 116 of file Door.h.

◆ accept_delay_

template<class Handler >
std::chrono::milliseconds ripple::Door< Handler >::accept_delay_ {INITIAL_ACCEPT_DELAY}
private

Definition at line 117 of file Door.h.

◆ backoff_timer_

template<class Handler >
boost::asio::steady_timer ripple::Door< Handler >::backoff_timer_
private

Definition at line 118 of file Door.h.

◆ FREE_FD_THRESHOLD

template<class Handler >
constexpr double ripple::Door< Handler >::FREE_FD_THRESHOLD = 0.70
staticconstexprprivate

Definition at line 119 of file Door.h.

◆ ios_

io_list* ripple::io_list::work::ios_ = nullptr
privateinherited

Definition at line 45 of file io_list.h.