RESTinio
|
Actual implementation of connection count limiter. More...
#include <connection_count_limiter.hpp>
Public Member Functions | |
actual_limiter_t (not_null_pointer_t< acceptor_callback_iface_t > acceptor, max_parallel_connections_t max_parallel_connections, max_active_accepts_t max_pending_indexes) | |
actual_limiter_t (const actual_limiter_t &)=delete | |
actual_limiter_t (actual_limiter_t &&)=delete | |
void | increment_parallel_connections () noexcept |
void | decrement_parallel_connections () noexcept |
void | accept_next (std::size_t index) noexcept |
Private Member Functions | |
RESTINIO_NODISCARD bool | has_free_slots () const noexcept |
Private Attributes | |
Mutex_Type | m_lock |
Lock object to be used. More... | |
not_null_pointer_t< acceptor_callback_iface_t > | m_acceptor |
Mandatory pointer to the acceptor connected with this limiter. More... | |
std::size_t | m_active_accepts { 0u } |
The counter of active accept() operations. More... | |
std::size_t | m_connections { 0u } |
The counter of active connections. More... | |
const std::size_t | m_max_parallel_connections |
The limit for parallel connections. More... | |
std::vector< std::size_t > | m_pending_indexes |
The storage for holding pending socket's slots. More... | |
Actual implementation of connection count limiter.
Mutex_Type | Type of mutex to be used for protection of limiter object. It is expected to be std::mutex or null_mutex_t. |
Definition at line 115 of file connection_count_limiter.hpp.
|
inline |
Definition at line 175 of file connection_count_limiter.hpp.
|
delete |
|
delete |
|
inlinenoexcept |
This method either calls acceptor_callback_iface_t::call_accept_now() (in that case m_active_accepts is incremented) or stores index into the internal storage.
Definition at line 236 of file connection_count_limiter.hpp.
|
inlinenoexcept |
Definition at line 202 of file connection_count_limiter.hpp.
|
inlineprivatenoexcept |
Definition at line 169 of file connection_count_limiter.hpp.
|
inlinenoexcept |
Definition at line 189 of file connection_count_limiter.hpp.
|
private |
Mandatory pointer to the acceptor connected with this limiter.
Definition at line 121 of file connection_count_limiter.hpp.
|
private |
The counter of active accept() operations.
Incremented every time the acceptor_callback_iface_t::call_accept_now() is invoked. Decremented in increment_parallel_connections().
Definition at line 138 of file connection_count_limiter.hpp.
|
private |
The counter of active connections.
This value is incremented in increment_parallel_connections() and decremented in decrement_parallel_connections().
Definition at line 146 of file connection_count_limiter.hpp.
|
private |
Lock object to be used.
Definition at line 118 of file connection_count_limiter.hpp.
|
private |
The limit for parallel connections.
Definition at line 149 of file connection_count_limiter.hpp.
|
private |
The storage for holding pending socket's slots.
Definition at line 165 of file connection_count_limiter.hpp.