restinio::connection_count_limits::impl::acceptor_callback_iface_t Class Referenceabstract

An interface of acceptor to be used by connection count limiters. More...

`#include <connection_count_limiter.hpp>`

Inheritance diagram for restinio::connection_count_limits::impl::acceptor_callback_iface_t:

## 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

## Detailed Description

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:

- the acceptor calls `accept_next` for the limiter;
- the limiter checks the possibility to call `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;
- sometime later the limiter calls `schedule_next_accept_attempt` for the acceptor. The acceptor then should perform a new call to `accept_next` in the appropriate worker context.

Since
  v.0.6.12

Definition at line 77 of file connection_count_limiter.hpp.

## Member Function Documentation

## call_accept_now()

virtual void restinio::connection_count_limits::impl::acceptor_callback_iface_t::call_accept_now | ( | std::size_t | index | ) |

pure virtual noexcept

This method will be invoked by a limiter when there is a possibility to call accept() right now.

Parameters

  index | An index of socket's slot to be used for accept().

Implemented in restinio::impl::acceptor_t< Traits >.

## schedule_next_accept_attempt()

virtual void restinio::connection_count_limits::impl::acceptor_callback_iface_t::schedule_next_accept_attempt | ( | std::size_t | index | ) |

pure virtual noexcept

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.

Parameters

  index | An index of socket's slot to be used for accept().

Implemented in restinio::impl::acceptor_t< Traits >.

The documentation for this class was generated from the following file:

- restinio/connection_count_limiter.hpp