RESTinio
|
Context for accepting http connections. More...
#include <acceptor.hpp>
Public Types | |
using | connection_factory_t = impl::connection_factory_t< Traits > |
using | connection_factory_shared_ptr_t |
using | logger_t = typename Traits::logger_t |
using | strand_t = typename Traits::strand_t |
using | stream_socket_t = typename Traits::stream_socket_t |
using | socket_holder_base_t = socket_supplier_t< stream_socket_t > |
Public Member Functions | |
template<typename Settings> | |
acceptor_t (Settings &settings, asio_ns::io_context &io_context, connection_factory_shared_ptr_t connection_factory, logger_t &logger) | |
void | open () |
Start listen on port specified in ctor. | |
void | close () |
Close listener if any. | |
auto & | get_open_close_operations_executor () noexcept |
Get an executor for close operation. |
Private Types | |
using | ip_blocker_base_t |
using | connection_count_limiter_t |
using | connection_lifetime_monitor_t |
Private Member Functions | |
auto & | get_executor () noexcept |
Get executor for acceptor. | |
void | call_accept_now (std::size_t index) noexcept override |
void | schedule_next_accept_attempt (std::size_t index) noexcept override |
::restinio::connection_count_limits::impl::acceptor_callback_iface_t * | self_as_acceptor_callback () noexcept |
Helper for suppressing warnings of using this in initilizer list. | |
void | accept_next (std::size_t i) noexcept |
Set a callback for a new connection. | |
void | accept_current_connection (std::size_t i, const std::error_code &ec) noexcept |
Accept current connection. | |
void | accept_connection_for_socket_with_index (std::size_t i) |
Performs actual actions for accepting a new connection. | |
void | do_accept_current_connection (stream_socket_t incoming_socket, endpoint_t remote_endpoint) |
void | close_impl () |
Close opened acceptor. |
Static Private Member Functions | |
static std::optional< asio_ns::ip::address > | try_extract_actual_address_from_variant (const restinio::details::address_variant_t &from) |
Helper for extraction of an actual IP-address from an instance of address_variant. |
Private Attributes | |
default_asio_executor | m_executor |
Asio executor. | |
strand_t | m_open_close_operations_executor |
const bool | m_separate_accept_and_create_connect |
Do separate an accept operation and connection instantiation. | |
connection_factory_shared_ptr_t | m_connection_factory |
Factory for creating connections. | |
logger_t & | m_logger |
connection_count_limiter_t | m_connection_count_limiter |
Actual limiter of active parallel connections. | |
const std::uint16_t | m_port |
Server endpoint. | |
const asio_ns::ip::tcp | m_protocol |
const restinio::details::address_variant_t | m_address |
std::unique_ptr< acceptor_options_setter_t > | m_acceptor_options_setter |
Server port listener and connection receiver routine. | |
asio_ns::ip::tcp::acceptor | m_acceptor |
acceptor_post_bind_hook_t | m_acceptor_post_bind_hook |
A hook to be called just after a successful call to bind for acceptor. |
Additional Inherited Members | |
Protected Member Functions inherited from restinio::impl::socket_supplier_t< Traits::stream_socket_t > | |
socket_supplier_t (Settings &settings, asio_ns::io_context &io_context) | |
Traits::stream_socket_t & | socket (std::size_t idx) |
Get the reference to socket. | |
Traits::stream_socket_t | move_socket (std::size_t idx) |
Extract the socket via move. | |
auto | concurrent_accept_sockets_count () const noexcept |
The number of sockets that can be used for cuncurrent accept operations. | |
Protected Member Functions inherited from restinio::impl::acceptor_details::ip_blocker_holder_t< Traits::ip_blocker_t > | |
ip_blocker_holder_t (const Settings &settings) | |
restinio::ip_blocker::inspection_result_t | inspect_incoming (Socket &socket) const noexcept |
Protected Attributes inherited from restinio::impl::acceptor_details::ip_blocker_holder_t< Traits::ip_blocker_t > | |
std::shared_ptr< Traits::ip_blocker_t > | m_ip_blocker |
Context for accepting http connections.
Definition at line 162 of file acceptor.hpp.
|
private |
Definition at line 171 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::connection_factory_shared_ptr_t |
Definition at line 178 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::connection_factory_t = impl::connection_factory_t< Traits > |
Definition at line 177 of file acceptor.hpp.
|
private |
Definition at line 173 of file acceptor.hpp.
|
private |
Definition at line 168 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::logger_t = typename Traits::logger_t |
Definition at line 180 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::socket_holder_base_t = socket_supplier_t< stream_socket_t > |
Definition at line 183 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::strand_t = typename Traits::strand_t |
Definition at line 181 of file acceptor.hpp.
using restinio::impl::acceptor_t< Traits >::stream_socket_t = typename Traits::stream_socket_t |
Definition at line 182 of file acceptor.hpp.
|
inline |
io_context | ASIO io_context to run on. |
connection_factory | Connection factory. |
logger | Logger. |
Definition at line 186 of file acceptor.hpp.
|
inlineprivate |
Performs actual actions for accepting a new connection.
i | socket index in the pool of sockets. |
Definition at line 444 of file acceptor.hpp.
|
inlineprivatenoexcept |
Accept current connection.
i | socket index in the pool of sockets. |
Definition at line 404 of file acceptor.hpp.
|
inlineprivatenoexcept |
Set a callback for a new connection.
Definition at line 393 of file acceptor.hpp.
|
inlineoverrideprivatevirtualnoexcept |
Implements restinio::connection_count_limits::impl::acceptor_callback_iface_t.
Definition at line 338 of file acceptor.hpp.
|
inline |
Close listener if any.
Definition at line 305 of file acceptor.hpp.
|
inlineprivate |
Close opened acceptor.
Definition at line 538 of file acceptor.hpp.
|
inlineprivate |
Definition at line 491 of file acceptor.hpp.
|
inlineprivatenoexcept |
Get executor for acceptor.
Definition at line 331 of file acceptor.hpp.
|
inlinenoexcept |
Get an executor for close operation.
Definition at line 324 of file acceptor.hpp.
|
inline |
Start listen on port specified in ctor.
Definition at line 220 of file acceptor.hpp.
|
inlineoverrideprivatevirtualnoexcept |
Implements restinio::connection_count_limits::impl::acceptor_callback_iface_t.
Definition at line 358 of file acceptor.hpp.
|
inlineprivatenoexcept |
Helper for suppressing warnings of using this in initilizer list.
Definition at line 376 of file acceptor.hpp.
|
inlinestaticnodiscardprivate |
Helper for extraction of an actual IP-address from an instance of address_variant.
Returns an empty value if there is no address inside from.
Definition at line 610 of file acceptor.hpp.
|
private |
Definition at line 572 of file acceptor.hpp.
|
private |
Server port listener and connection receiver routine.
Definition at line 571 of file acceptor.hpp.
|
private |
A hook to be called just after a successful call to bind for acceptor.
Definition at line 578 of file acceptor.hpp.
|
private |
Definition at line 566 of file acceptor.hpp.
|
private |
Actual limiter of active parallel connections.
Definition at line 598 of file acceptor.hpp.
|
private |
Factory for creating connections.
Definition at line 589 of file acceptor.hpp.
|
private |
Asio executor.
Definition at line 582 of file acceptor.hpp.
|
private |
Definition at line 591 of file acceptor.hpp.
|
private |
Definition at line 583 of file acceptor.hpp.
|
private |
Server endpoint.
Definition at line 564 of file acceptor.hpp.
|
private |
Definition at line 565 of file acceptor.hpp.
|
private |
Do separate an accept operation and connection instantiation.
Definition at line 586 of file acceptor.hpp.