RESTinio
|
An interface of acceptor to be used by connection count limiters. More...
#include <connection_count_limiter.hpp>
Public Member Functions | |
virtual void | call_accept_now (std::size_t index) noexcept=0 |
virtual void | schedule_next_accept_attempt (std::size_t index) noexcept=0 |
An interface of acceptor to be used by connection count limiters.
An instance of a connection count limiter will receive a reference to the acceptor. The limiter has to call the acceptor and this interface declares methods of the acceptor that will be invoked by the limiter.
The assumed working scheme is:
accept_next
for the limiter;accept()
. If it is possible, then the limiter calls call_accept_now
back (right inside accept_next
invocation). If it isn't possible, then the limiter stores the socket's slot index somewhere inside the limiter;schedule_next_accept_attempt
for the acceptor. The acceptor then should perform a new call to accept_next
in the appropriate worker context.Definition at line 77 of file connection_count_limiter.hpp.
|
pure virtualnoexcept |
This method will be invoked by a limiter when there is a possibility to call accept() right now.
index | An index of socket's slot to be used for accept(). |
Implemented in restinio::impl::acceptor_t< Traits >.
|
pure virtualnoexcept |
This method will be invoked by a limiter when there is no possibility to call accept() right now, but the next call to accept_next
should be scheduled as soon as possible in the appropriate worker context.
It is assumed that the acceptor will use asio::post() with a completion handler that calls the accept_next
method of the limiter.
index | An index of socket's slot to be used for accept(). |
Implemented in restinio::impl::acceptor_t< Traits >.